Implementing the update profile code in the controller