protected function _actionAdd(AnCommandContext $context)
    {
        $data = $context->data;

        dispatch_plugin('user.onBeforeLoginPerson', array('credentials' => $data));

        if ($data->return) {
            AnRequest::set('session.return', $data->return);
            $context->url = base64UrlDecode($data->return);
        } else {
            AnRequest::set('session.return', '');
        }

        $credentials = array(
            'username' => $data->username,
            'password' => $data->password
        );

        $response = $this->getService('com:people.authentication.response');

        dispatch_plugin('authentication.onAuthenticate', array(
                            'credentials' => $credentials,
                            'response' => $response
                        ));

        if ($response->status === ComPeopleAuthentication::STATUS_SUCCESS) {
            $person = $this->getService('com:people.helper.person')->login($credentials);
            $this->_state->setItem($person);
            $this->getResponse()->status = AnHttpResponse::CREATED;

            dispatch_plugin('user.onAfterLoginPerson', array('person' => $this->person));

            if(! $context->url) {
                $context->url = route(array(
                    'option' => 'com_people',
                    'view' => 'people',
                    'uniqueAlias' => $person->username
                ));
            }

            $this->getResponse()->setRedirect($context->url);
            AnRequest::set('session.return', '');
        } else {
            $this->setMessage(translate('COM-PEOPLE-AUTHENTICATION-FAILED'), 'error');
            throw new LibBaseControllerExceptionUnauthorized('Authentication Failed. Check username/password');
            $this->getResponse()->status = AnHttpResponse::FORBIDDEN;
            $this->getResponse()->setRedirect(route('option=com_people&view=session'));
        }
    }