/// <summary>
 ///     Gets the stream controller.
 /// </summary>
 /// <param name="endpoint">The endpoint.</param>
 /// <param name="structureOutputFormat">The structure output format.</param>
 /// <param name="sdmxObjects">The SDMX objects.</param>
 /// <returns>The <see cref="IStreamController{XmlWriter}" />.</returns>
 private IStreamController<XmlWriter> GetStreamController(WebServiceEndpoint endpoint, StructureOutputFormat structureOutputFormat, ISdmxObjects sdmxObjects)
 {
     IStreamController<XmlWriter> streamController =
         new StreamController<XmlWriter>(
             (writer, queue) =>
             {
                 IStructureFormat format = new SdmxStructureXmlFormat(structureOutputFormat, endpoint, writer, queue);
                 this._writerManager.WriteStructures(sdmxObjects, format, null);
             });
     return streamController;
 }
 /// <summary>
 /// Gets the stream controller.
 /// </summary>
 /// <param name="structureOutputFormat">The structure output format.</param>
 /// <param name="sdmxObjects">The SDMX objects.</param>
 /// <param name="encoding">The encoding.</param>
 /// <returns>The <see cref="IStreamController{XmlWriter}" />.</returns>
 private IStreamController<Stream> GetStreamController(StructureOutputFormat structureOutputFormat, ISdmxObjects sdmxObjects, Encoding encoding)
 {
     IStreamController<Stream> streamController =
         new StreamController<Stream>(
             (writer, queue) =>
                 {
                     using (var xmlWriter = XmlWriter.Create(writer, new XmlWriterSettings() { Encoding = encoding }))
                     {
                         IStructureFormat format = new SdmxStructureXmlFormat(structureOutputFormat, WebServiceEndpoint.StandardEndpoint, xmlWriter, queue);
                         this._writerManager.WriteStructures(sdmxObjects, format, null);
                     }
                 });
     return streamController;
 }
        /// <summary>
        /// Gets the core structure writer factory.
        /// </summary>
        /// <param name="sdmxStructureXmlFormat">The SDMX structure XML format.</param>
        /// <returns>The <see cref="IStructureWriterFactory"/>.</returns>
        private static IStructureWriterFactory GetCoreStructureWriterFactory(SdmxStructureXmlFormat sdmxStructureXmlFormat)
        {
            IStructureWriterFactory decoratingFactory = null;
            switch (sdmxStructureXmlFormat.SdmxOutputFormat.OutputVersion.EnumType)
            {
                case SdmxSchemaEnumType.VersionTwo:
                    decoratingFactory = sdmxStructureXmlFormat.Endpoint == WebServiceEndpoint.EstatEndpoint
                                            ? (IStructureWriterFactory)new SdmxStructureWriterV2Factory(sdmxStructureXmlFormat.XMLWriter)
                                            : new SdmxStructureWriterFactory(sdmxStructureXmlFormat.XMLWriter);
                    break;
                case SdmxSchemaEnumType.VersionTwoPointOne:
                    decoratingFactory = new SdmxStructureWriterFactory(sdmxStructureXmlFormat.XMLWriter);
                    break;
            }

            return decoratingFactory;
        }