private void RegisterUser(string identifier)
        {
            CurrentUser.SetIdentifier(identifier);
            var identity = PermissionService.RegisterUserIfNotExists(identifier);

            CurrentUser.SetUser(identity);
        }
        // https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-2.0&tabs=aspnetcore2x#per-request-dependencies
        public async Task Invoke(HttpContext context, CurrentUserProvider currentUser,
                                 PermissionService permissionService)
        {
            var userName = context.User.Identity.Name;

            _logger.LogInformation($"Invoke - {userName}");

            currentUser.SetIdentifier(userName);
            SecurityIdentity identity;

            lock (lockObj)
            {
                identity = permissionService.RegisterUserIfNotExists(userName ?? "Anonymous");
            }
            currentUser.SetUser(identity);

            await _next(context);
        }