implement update and insert methods