/// <inheritdoc/> public async Task <DeviceTwinModel> GetAsync(string deviceId, string moduleId, CancellationToken ct) { try { Twin twin = null; if (string.IsNullOrEmpty(moduleId)) { twin = await _registry.GetTwinAsync(deviceId, ct); } else { twin = await _registry.GetTwinAsync(deviceId, moduleId, ct); } return(twin.ToModel()); } catch (Exception e) { _logger.Verbose(e, "Get twin failed "); throw e.Rethrow(); } }