public static ApiResponse GetResponseDetails(this HttpContext context, Exception apiException = null, string message = null)
        {
            ApiResponse response = null;

            try
            {
                // get action  action ReturnType
                Type           responseDeclaredType = context.GetActionReturnType();
                HttpStatusCode statusCode           = apiException != null ? HttpStatusCode.Conflict : (HttpStatusCode)context.Response.StatusCode;

                // create api response
                response = new ApiResponse(context.Response.StatusCode)
                {
                    TraceId    = GeneralContext.CreateTraceId(),
                    RequestUrl = context.GetRequestUrl(),
                    Value      = responseDeclaredType?.GetDefault(),
                    ActionType = responseDeclaredType,
                    StatusCode = $"{(int)statusCode}: {statusCode}",
                    Message    = message ?? apiException?.GetApiMessageInfo() ?? ((HttpStatusCode)context.Response.StatusCode).ToString(),
                    Error      = apiException != null ? new ApiError(apiException) : null
                };

                GeneralContext.Logger.Error($"traceId: {response.TraceId}, error: {response.Message}");
            }
            catch (Exception ex)
            {
                GeneralContext.Logger.Error(ex.GetApiMessageInfo("Unhandled exception"));
                //context.Response.StatusCode = StatusCodes.Status500InternalServerError;
            }

            return(response);
        }