change in update method, add condition before SaveChanges