Abstract some common operations into functionInventory.