public function generateToken(User $user, $tokenType)
    {
        if (!isset($this->timeToLive[$tokenType])) {
            user_error('Please specify a timeToLive for the tokenType "' . $tokenType . '" at Token::$timeToLive.', E_USER_ERROR);
        }

        do {
            $token = md5(microtime(true) . Configure::read('Security.salt') . $user->get('id') . $user->get('email'));
        } while ((bool)$this->tokenExists($token));

        $this->save(
            new Entity([
                'user_id' => $user->get('id'),
                'token' => $token,
                'token_type' => $tokenType,
                'expires' => new DateTime($this->timeToLive[$tokenType])
            ])
        );

        return $token;
    }