refactored to make the update of a user more generic