public DeviceRegistryRepository(IConfigurationProvider configProvider, IDocDbRestHelper docDbRestHelper) { if (configProvider == null) { throw new ArgumentNullException("configProvider"); } _endpointUri = configProvider.GetConfigurationSettingValue("docdb.EndpointUrl"); _authorizationKey = configProvider.GetConfigurationSettingValue("docdb.PrimaryAuthorizationKey"); _databaseId = configProvider.GetConfigurationSettingValue("docdb.DatabaseId"); _documentCollectionName = configProvider.GetConfigurationSettingValue("docdb.DocumentCollectionId"); _docDbRestHelper = docDbRestHelper; Task.Run(() => _docDbRestHelper.InitializeDatabase()).Wait(); Task.Run(() => _docDbRestHelper.InitializeDeviceCollection()).Wait(); }