Add functions to insert or update items