code: public function editProfile($data)
      {
          /* @var $user UserInterface */
          if (!($user = $this->hydrate($data, $this->getEditProfileForm()))) {
              return;
          }
  
      	$eventManager = $this->getEventManager();
      	$eventManager->trigger(__FUNCTION__, $this, compact('user'));
  
      	$this->getMapper()->update($user)->save();
  
      	$eventManager->trigger(__FUNCTION__ . '.post', $this, compact('user'));
  
      	return $user;
      }
docs: Edit user profile
  
  @param array|UserInterface $data
  @return UserInterface|void