protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format)
        {
            // First serialize the base type.
            if (_baseSerializer != null)
            {
                _baseSerializer.Serialize(output, value, format);
            }

            // Now serialize our own elements.
            foreach (var info in _elements)
            {
                var elementValue = info.Getter(value);

                if (info.Attribute.SharedResource)
                {
                    output.WriteSharedResource(elementValue, info.Attribute);
                }
                else
                {
                    output.WriteObjectInternal(elementValue, info.Attribute, info.Serializer, info.Serializer.TargetType);
                }
            }

            if (_collectionHelper != null)
            {
                _collectionHelper.Serialize(output, value, format);
            }
        }