update state code and return user object after update