check if we are updating or inserting