public function createTemporaryUser($parameters)
    {
        $email = trim(strtolower(array_value($parameters, 'email')));
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new AuthException('Invalid email address');
        }

        $insertArray = array_replace($parameters, ['enabled' => false]);

        // create the temporary user
        $userClass = $this->auth->getUserClass();
        $user = new $userClass();
        $driver = $userClass::getDriver();
        $created = $driver->createModel($user, $insertArray);

        if (!$created) {
            throw new AuthException('Could not create temporary user');
        }

        // get the new user ID
        $id = [];
        foreach ($userClass::getIDProperties() as $k) {
            $id[] = $driver->getCreatedID($user, $k);
        }

        $user = $userClass::find($id);

        // create the temporary link
        $link = new UserLink();
        $link->user_id = $user->id();
        $link->type = UserLink::TEMPORARY;
        $link->saveOrFail();
        $user->setTemporaryLink($link);

        return $user;
    }