public static CollectorDesiredConfiguration CollectorToMessage(EventTracingDataContract.CollectorDesiredState collector)
        {
            Logger.Log("Reading collector desired configuration...", LoggingLevel.Information);

            CollectorDesiredConfiguration msgCollector = new CollectorDesiredConfiguration();

            msgCollector.Name = collector.name;
            msgCollector.ReportToDeviceTwin  = CommonDataContract.BooleanToYesNoJsonString(collector.reportToDeviceTwin);
            msgCollector.ApplyFromDeviceTwin = CommonDataContract.BooleanToYesNoJsonString(collector.applyFromDeviceTwin);
            msgCollector.CSPConfiguration    = CollectorInternalToMessage(collector.collectorInner);
            return(msgCollector);
        }
            public static EventTracingDesiredState FromJsonObject(JObject eventTracingCollectorsNode)
            {
                Logger.Log("Building native request from desired json...", LoggingLevel.Information);

                EventTracingDataContract.DesiredProperties desiredPropertyies = EventTracingDataContract.DesiredProperties.FromJsonObject(eventTracingCollectorsNode);

                EventTracingDesiredState jsonRequest = new EventTracingDesiredState();

                jsonRequest.generalReportLevel   = desiredPropertyies.generalReportLevel;
                jsonRequest.configuredCollectors = new HashSet <string>();
                jsonRequest.request = new SetEventTracingConfigurationRequest();

                foreach (EventTracingDataContract.CollectorDesiredState collector in desiredPropertyies.collectors)
                {
                    CollectorDesiredConfiguration msgCollector = SystemConfiguratorConverters.CollectorToMessage(collector);
                    jsonRequest.request.Collectors.Add(msgCollector);
                    jsonRequest.configuredCollectors.Add(msgCollector.Name);
                }

                return(jsonRequest);
            }