/// <summary>Static method to serialize the metadata object.</summary>
        /// <remarks>
        /// For each serialisation, a new XMPSerializer
        /// instance is created, either XMPSerializerRDF or XMPSerializerPlain so that its possible to
        /// serialialize the same XMPMeta objects in two threads.
        /// </remarks>
        /// <param name="xmp">a metadata implementation object</param>
        /// <param name="stream">the output stream to serialize to</param>
        /// <param name="options">serialization options, can be <c>null</c> for default.</param>
        /// <exception cref="XmpException"/>
        public static void Serialize(XmpMeta xmp, Stream stream, SerializeOptions options)
        {
            options = options ?? new SerializeOptions();

            // sort the internal data model on demand
            if (options.Sort)
                xmp.Sort();

            new XmpSerializerRdf().Serialize(xmp, stream, options);
        }
        /// <summary>Static method to serialize the metadata object.</summary>
        /// <remarks>
        /// For each serialisation, a new XMPSerializer
        /// instance is created, either XMPSerializerRDF or XMPSerializerPlain so that its possible to
        /// serialize the same XMPMeta objects in two threads.
        /// </remarks>
        /// <param name="xmp">a metadata implementation object</param>
        /// <param name="stream">the output stream to serialize to</param>
        /// <param name="options">serialization options, can be <c>null</c> for default.</param>
        /// <exception cref="XmpException"/>
        public static void Serialize(XmpMeta xmp, Stream stream, SerializeOptions options)
        {
            options = options ?? new SerializeOptions();

            // sort the internal data model on demand
            if (options.Sort)
            {
                xmp.Sort();
            }

            new XmpSerializerRdf().Serialize(xmp, stream, options);
        }
        /// <summary>Static method to serialize the metadata object.</summary>
        /// <remarks>
        /// For each serialisation, a new XMPSerializer
        /// instance is created, either XMPSerializerRDF or XMPSerializerPlain so that its possible to
        /// serialize the same XMPMeta objects in two threads.
        /// </remarks>
        /// <param name="xmp">a metadata implementation object</param>
        /// <param name="stream">the output stream to serialize to</param>
        /// <param name="options">serialization options, can be <c>null</c> for default.</param>
        /// <exception cref="XmpException" />
        public static void Serialize(XmpMeta xmp, Stream stream, SerializeOptions options)
        {
            options = options ?? new SerializeOptions();

            // sort the internal data model on demand
            if (options.Sort)
            {
                xmp.Sort();
            }

            // <#AdobePrivate> This is not very aesthetic, but needed to strip the block
            // The Plain XMP format is disabled
            //        if (options.getUsePlainXMP())
            //        {
            //            new XMPSerializerPlain().serialize(xmp, out, options);
            //            return;
            //        }
            // </#AdobePrivate>

            new XmpSerializerRdf().Serialize(xmp, stream, options);
        }