internal static HttpResponseMessage GetHttpResponseMessageFromMessage(Message message)
        {
            HttpResponseMessage httpResponseMessage = null;

            HttpResponseMessageProperty property = message.Properties.GetValue <HttpResponseMessageProperty>(HttpResponseMessageProperty.Name);

            if (property != null)
            {
                httpResponseMessage = property.HttpResponseMessage;
                if (httpResponseMessage != null)
                {
                    httpResponseMessage.CopyPropertiesFromMessage(message);
                    message.EnsureReadMessageState();
                }
            }

            return(httpResponseMessage);
        }