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);
            }
        private JObject ReportedFromResponse(GetEventTracingConfigurationResponse response, EventTracingDataContract.ReportLevel generalReportLevel, HashSet <string> configuredCollectors)
        {
            Logger.Log("Building diagnostic logs reported properties...", LoggingLevel.Information);

            EventTracingDataContract.ReportedProperties reportedProperties = new EventTracingDataContract.ReportedProperties();

            foreach (CollectorReportedConfiguration msgCollector in response.Collectors)
            {
                string applicableReporting = EventTracingDataContract.JsonReportLevelNone;

                if (msgCollector.ReportToDeviceTwin == DMJSonConstants.YesString)
                {
                    applicableReporting = EventTracingDataContract.JsonReportLevelDetailed;
                }
                else if (!configuredCollectors.Contains(msgCollector.Name))
                {
                    if (generalReportLevel == EventTracingDataContract.ReportLevel.Detailed)
                    {
                        applicableReporting = EventTracingDataContract.JsonReportLevelDetailed;
                    }
                    if (generalReportLevel == EventTracingDataContract.ReportLevel.Minimal)
                    {
                        applicableReporting = EventTracingDataContract.JsonReportLevelMinimal;
                    }
                }

                if (applicableReporting == EventTracingDataContract.JsonReportLevelDetailed)
                {
                    var collectorInner = SystemConfiguratorConverters.CollectorInnerFromMessage(msgCollector);
                    reportedProperties.collectorsDetailed.Add(collectorInner);
                }
                else if (applicableReporting == EventTracingDataContract.JsonReportLevelMinimal)
                {
                    reportedProperties.collectorsMinimal.Add(msgCollector.Name);
                }
            }

            return(reportedProperties.ToJsonObject());
        }