public function create($data)
    {
        $authService = $this->options->getAuthenticationService();

        if ($authService->hasIdentity()) {
            $authService->logout();
        }

        $result = $authService->login(
            $data[$this->options->getDataUsernameKey()],
            $data[$this->options->getDataPasswordKey()],
            isset($data[$this->options->getDataRememberMeKey()]) ? $data[$this->options->getDataRememberMeKey()]: false
        );
        if (!$result->isValid()) {
            throw new Exception\LoginFailedException(implode('. ', $result->getMessages()));
        }

        $this->response->getHeaders()->addHeader(
            Location::fromString(
                'Location: ' . $this->request->getUri()->getPath()
            )
        );

        return $this->model->setVariables($this->options->getSerializer()->toArray($result->getIdentity()));
    }