write query now updates the data if id of an object is available