method update of usercotroller refactored