public async Task InvokeAsync(HttpContext httpContext)
 {
     try
     {
         await _next(httpContext);
     }
     catch (Exception ex)
     {
         var currentDate = DateTime.Now;
         var userId      = httpContext.User.FindFirst("UserId")?.Value;
         _service.InsertError(userId, currentDate, httpContext.Response.StatusCode, ex.Message, ex.StackTrace);
     }
 }