public function editProfileAction()
    {
        if(!$user = $this->identity()) {
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }
        
        $form = $this->getUserFormHelper()->createUserForm($user, 'EditProfile');
        $email = $user->getEmail();
        $username = $user->getUsername();
        $message = null;    
        if($this->getRequest()->isPost()) {
            $currentFirstName = $user->getFirstName();
            $currentLastName = $user->getLastName();
            $form->setValidationGroup('firstName', 'lastName', 'language', 'csrf');
            $form->setData($this->getRequest()->getPost());
            if($form->isValid()) {
                $firstName = $this->params()->fromPost('firstName');
                $lastName = $this->params()->fromPost('lastName');
                $user->setFirstName($firstName);
                $user->setLastName($lastName);    
                $entityManager = $this->getEntityManager();
                $entityManager->persist($user);
                $entityManager->flush();    
                $message =  $this->getTranslatorHelper()->translate('Your profile has been edited');
            }
        }
    
        return new ViewModel(array(
            'form' => $form,
            'email' => $email,
            'username' => $username,
            'securityQuestion' => $user->getQuestion()->getQuestion(),
            'message' => $message,
            'navMenu' => $this->getOptions()->getNavMenu()
        ));
    }