added insert and update method