protected function createUser(array $credentials)
    {
        $entity = static::ENTITY_CLASSNAME;

        if (count(array_only($credentials, ['email', 'password', 'username'])) < 3)
        {
            throw new \InvalidArgumentException("Missing arguments.");
        }

        /** @var User $user */
        $user = new $entity(
            $credentials['email'],
            $credentials['password'],
            $credentials['username']
        );

        $rest = array_except($credentials, ['email', 'username', 'password']);
        if (! empty($rest))
        {
            $user->update($rest);
        }

        return $user;
    }