private Task WriteProblemDetails(HttpContext context, MvcProblemDetails details)
        {
            Options.AddTraceId(context, details);

            Options.OnBeforeWriteDetails?.Invoke(context, details);

            var routeData = context.GetRouteData() ?? EmptyRouteData;

            var actionContext = new ActionContext(context, routeData, EmptyActionDescriptor);

            var result = new ObjectResult(details)
            {
                StatusCode   = details.Status ?? context.Response.StatusCode,
                ContentTypes = Options.ContentTypes,
                DeclaredType = details.GetType(),
            };

            return(Executor.ExecuteAsync(actionContext, result));
        }