trying to implement insert and update, not yet complete