refactor of __insert_update statements