public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            var objectContent = actionExecutedContext.Response.Content as ObjectContent;

            if (objectContent != null)
            {
                var type  = objectContent.ObjectType; //type of the returned object
                var value = objectContent.Value;      //holding the returned value
                if (value.GetType() != typeof(TrailerResponseObject))
                {
                    TrailerResponseObject responseObject = new TrailerResponseObject();
                    responseObject.dataObject = value;
                    responseObject.hasError   = false;
                    objectContent.Value       = responseObject;
                }
            }
        }
        private void HandleException(Exception ex, IOwinContext context)
        {
            var request = context.Request;

            string ip         = request.RemoteIpAddress;
            string stackTrace = ex.StackTrace;

            // add user details
            //Store error details to database and get a ID

            logger.Error(stackTrace);

            TrailerResponseObject errorResponse = new TrailerResponseObject();

            errorResponse.hasError = true;
            errorResponse.message  = "Error details can be found in logs";

            context.Response.StatusCode  = (int)HttpStatusCode.OK;
            context.Response.ContentType = "application/json";
            context.Response.Write(JsonUtils.SerializeObject(errorResponse));
        }