public function registerAction()
    {
        $encrypted = $this->params()->fromQuery('q');
        $crypt = new Crypt();
        if ($crypt->decryptArrayResponse($encrypted) != false) {
            $decryptedArray = $crypt->decryptArrayResponse(json_encode($encrypted));
            if ($this->getUserTable()->isUniqueEmail($decryptedArray->response->email)) {
                $output = $crypt->encryptArrayResponse($decryptedArray->response->email);
                //var_dump($decryptedArray);
                $appId = base64_decode($decryptedArray->response->appId);
                $from = '*****@*****.**';
                $email = $decryptedArray->response->email;
                $assunto = 'Ativação Conta MarkSend';
                $activationLink = $this->getServiceLocator()->get('Config')['app'][$appId]['url'] . 'user/activate/' . urlencode(base64_encode($output));
                $mensagem = <<<EOD
                            <a href='{$activationLink}'>{$activationLink}</a>
EOD;
                $ses = new SimpleEmailService('AKIAIX32JUETXGGVTYGA', '1/D6IFvP6VAs3yKsqTsh7l179nj7m5PBogwAYc23');
                //cria uma nova instancia
                $m = new SimpleEmailServiceMessage();
                //seta valores definidos nas variaveis acima
                $m->addTo($email);
                $m->setFrom($from);
                $m->setSubjectCharset('ISO-8859-1');
                $m->setMessageCharset('ISO-8859-1');
                $m->setSubject('=?UTF-8?B?' . base64_encode($assunto) . '?= ');
                $m->setMessageFromString(NULL, $mensagem);
                //envia email
                $ses->sendEmail($m);
                // New User
                //var_dump($decryptedArray);
                $user = new User();
                $user->setEmail($decryptedArray->response->email);
                $user->setFirstName($decryptedArray->response->name);
                $user->setLastName($decryptedArray->response->surname);
                $user->setPassword($decryptedArray->response->pass);
                //var_dump($user);
                $saveUser = $this->getUserTable()->saveUser($user);
                if ($saveUser > 0) {
                    //Salvou
                    $response = array('success' => true);
                } else {
                    //Deu algo errado e nao salvou =/
                    $response = array('success' => false, 'errorCode' => '1', 'message' => 'Not saved');
                }
            } else {
                //Email ja Cadastrado
                $response = array('success' => false, 'errorCode' => '2', 'message' => 'Email already registered');
            }
            $sm = $this->getServiceLocator();
            $this->_adapter = $sm->get('zend_db_adapter');
            $output = $crypt->encryptArrayResponse($response);
            $result = new JsonModel(array('return' => $output));
            return $result;
        }
    }