protected Message CreateResponseMessage(SyncSerializationFormat serializationFormat, SyncWriter oDataWriter)
        {
            var bodyWriter = new DelegateBodyWriter(WriteResponse, oDataWriter);

            Message message = Message.CreateMessage(MessageVersion.None, String.Empty, bodyWriter);

            switch (serializationFormat)
            {
            case SyncSerializationFormat.ODataAtom:
                message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Xml));
                break;

            case SyncSerializationFormat.ODataJson:
                message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Json));
                break;
            }

            var property = new HttpResponseMessageProperty {
                StatusCode = HttpStatusCode.OK
            };

            property.Headers[HttpResponseHeader.ContentType] = WebUtil.GetContentType(serializationFormat);

            // Copy the SyncOperationContext's ResponseHeaders if present
            if (this._operationContext != null)
            {
                property.Headers.Add(this._operationContext.ResponseHeaders);
            }

            message.Properties.Add(HttpResponseMessageProperty.Name, property);

            return(message);
        }
        protected Message CreateResponseMessage(SyncSerializationFormat serializationFormat, SyncWriter oDataWriter)
        {
            var bodyWriter = new DelegateBodyWriter(WriteResponse, oDataWriter);

            Message message = Message.CreateMessage(MessageVersion.None, String.Empty, bodyWriter);

            switch (serializationFormat)
            {
                case SyncSerializationFormat.ODataAtom:
                    message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Xml));
                    break;
                case SyncSerializationFormat.ODataJson:
                    message.Properties.Add(WebBodyFormatMessageProperty.Name, new WebBodyFormatMessageProperty(WebContentFormat.Json));
                    break;
            }

            var property = new HttpResponseMessageProperty { StatusCode = HttpStatusCode.OK };
            property.Headers[HttpResponseHeader.ContentType] = WebUtil.GetContentType(serializationFormat);
            
            // Copy the SyncOperationContext's ResponseHeaders if present
            if (this._operationContext != null)
            {
                property.Headers.Add(this._operationContext.ResponseHeaders);
            }

            message.Properties.Add(HttpResponseMessageProperty.Name, property);

            return message;
        }