/// <summary>
        /// Called to write the payload to the specified <paramref name="messageWriter"/>.
        /// </summary>
        /// <param name="messageWriter">The <see cref="ODataMessageWriterTestWrapper"/> to use for writing the payload.</param>
        /// <param name="testConfiguration">The test configuration to generate the payload for.</param>
        protected override void WritePayload(ODataMessageWriterTestWrapper messageWriter, WriterTestConfiguration testConfiguration)
        {
            ODataPayloadElement payload = this.PayloadElement.DeepCopy();

            if (testConfiguration.Format == ODataFormat.Json)
            {
                payload.Accept(new ODataPayloadJsonNormalizer());
                //Fixup added as odatalib requires ids on feeds even though it can't be represented in json
                payload.Accept(new AddFeedIDFixup());
            }
            else if (testConfiguration.Format == ODataFormat.Atom)
            {
                // TODO: Remove visitor
                payload.Accept(new ODataPayloadElementNullIDVisitor());
            }

            ODataPayloadElementToObjectModelConverter converter = new ODataPayloadElementToObjectModelConverter(!testConfiguration.IsRequest);

            if (this.PayloadKind != ODataPayloadKind.Batch)
            {
                this.settings.ObjectModelToMessageWriter.WriteMessage(messageWriter, this.PayloadKind, converter.Convert(payload));
            }
            else
            {
                TestWriterUtils.WriteBatchPayload(messageWriter,
                                                  payload,
                                                  converter,
                                                  this.settings.ObjectModelToMessageWriter,
                                                  this.Model,
                                                  this.settings.Assert,
                                                  testConfiguration,
                                                  true);
            }
        }