added a function that uses 'update' instead of 'insert' when the row is already exists.