protected function createLocalUser(string $provider, array $attributes)
    {
        $localUser = app('cortex.auth.member');

        $attributes['password'] = str_random();
        $attributes['email_verified_at'] = now();
        $attributes['is_active'] = ! config('cortex.auth.registration.moderated');

        $localUser->fill($attributes)->save();

        // Fire the register success event
        event(new Registered($localUser));

        $localUser->socialites()->create([
            'provider' => $provider,
            'provider_uid' => $attributes['id'],
        ]);

        return $localUser;
    }