/**
  * @param Notification $notification
  *
  * @return string
  */
 private function getFormattedUserName(Notification $notification)
 {
     $user = $notification->getAuthor();
     $userId = $this->userService->verifyDiamanteUserExists($user->getEmail());
     $user = empty($userId) ? $user : new User($userId, User::TYPE_DIAMANTE);
     $user = $this->userService->getByUser($user);
     $format = $this->nameFormatter->getNameFormat();
     $name = str_replace(array('%first_name%', '%last_name%', '%prefix%', '%middle_name%', '%suffix%'), array($user->getFirstName(), $user->getLastName(), '', '', ''), $format);
     return trim($name);
 }
 /**
  * @param $user
  * @return \Diamante\UserBundle\Entity\DiamanteUser|\Oro\Bundle\UserBundle\Entity\User
  */
 private function getUserDependingOnType($user)
 {
     if ($user instanceof OroUser) {
         return $user;
     }
     if ($user instanceof ApiUser) {
         $userId = $this->userService->verifyDiamanteUserExists($user->getEmail());
         $user = empty($userId) ? $user : new User($userId, User::TYPE_DIAMANTE);
     }
     $result = $this->userService->getByUser($user);
     return $result;
 }