change specification of insert and add new method upsert