/// <summary>
        /// Clear registry
        /// </summary>
        private static async Task CleanupAsync(IIoTHubConfig config,
                                               bool includeSupervisors)
        {
            var logger   = LogEx.Console(LogEventLevel.Error);
            var registry = new IoTHubServiceHttpClient(new HttpClient(logger),
                                                       config, logger);
            var result = await registry.QueryDeviceTwinsAsync(
                "SELECT * from devices where IS_DEFINED(tags.DeviceType)");

            foreach (var item in result)
            {
                Console.WriteLine($"Deleting {item.Id} {item.ModuleId ?? ""}");
                await registry.DeleteAsync(item.Id, item.ModuleId);
            }
            if (!includeSupervisors)
            {
                return;
            }
            var query = "SELECT * FROM devices.modules WHERE " +
                        $"properties.reported.{TwinProperty.kType} = 'supervisor'";
            var supers = await registry.QueryDeviceTwinsAsync(query);

            foreach (var item in supers)
            {
                Console.WriteLine($"Deleting {item.Id} {item.ModuleId ?? ""}");
                await registry.DeleteAsync(item.Id, item.ModuleId);
            }
        }
        /// <summary>
        /// List all twin module identities
        /// </summary>
        private static async Task ListAsync(IIoTHubConfig config)
        {
            var logger   = LogEx.Console(LogEventLevel.Error);
            var registry = new IoTHubServiceHttpClient(new HttpClient(logger),
                                                       config, logger);

            var query = "SELECT * FROM devices.modules WHERE " +
                        $"properties.reported.{TwinProperty.kType} = 'supervisor'";
            var supers = await registry.QueryDeviceTwinsAsync(query);

            foreach (var item in supers)
            {
                Console.WriteLine($"{item.Id} {item.ModuleId}");
            }
        }