public override void OnResultExecuting(ResultExecutingContext context)
        {
            var objectResult = context.Result as ObjectResult;

            if (objectResult?.Value is IApiResponse response && (response.HasErrors() || response.IsResource()))
            {
                response.AddMeta(defaultMetaDataRetriever.GetDefaultMetaData());
            }
        }
        public override void OnException(ExceptionContext context)
        {
            var apiError = context.Exception as JsonApiException;

            var responseCode = apiError?.Status ?? HttpStatusCode.InternalServerError;
            var detail       = apiError?.Message ?? context.Exception.Message;

            context.ExceptionHandled = true;

            logger.LogError($"Request for '{context.HttpContext.Request.Path}' threw an exception: '{context.Exception}");

            var response = ApiResponse.WithStatus(responseCode).WithError(error =>
            {
                error.WithStatus(responseCode).WithDetail(detail);
            });

            response.AddMeta(defaultMetaDataRetriever.GetDefaultMetaData());

            context.Result = new ObjectResult(response.AsResponse());
        }