public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            try
            {
                _dbContext.BeginTransaction();
                await next();

                await _dbContext.CommitTransactionAsync();
            }
            catch (Exception)
            {
                _dbContext.RollbackTransaction();
                throw;
            }
        }
            public async Task <Auth0AppMetaData> Handle(ProvisionUser cmd)
            {
                var existingUser = await _db.Users
                                   .FirstActiveAsync(x => x.AuthId == cmd.AuthId)
                                   .ConfigureAwait(false);

                var metaData = new Auth0AppMetaData();

                if (existingUser != null)
                {
                    metaData.userId = existingUser.Id;
                    return(metaData);
                }

                var user = User.Create(cmd.AuthId);

                _db.Users.Add(user);
                _db.BeginTransaction();
                await _db.CommitTransactionAsync().ConfigureAwait(false);

                metaData.userId = user.Id;
                return(metaData);
            }