public IInfrastructureCoordinator Create()
        {
            IManagementClient managementClient;

            try
            {
                managementClient = new ManagementClientFactory().Create();
            }
            catch (Exception ex)
            {
                Trace.WriteError(TraceType, "Error creating management client. Cannot continue further. Exception: {0}", ex);
                throw;
            }

            var retryPolicyFactory = new LinearRetryPolicyFactory(
                TraceType,
                Constants.BackoffPeriodInMilliseconds,
                Constants.MaxRetryAttempts,
                AzureHelper.IsRetriableException);

            var versionedPropertyStore = VersionedPropertyStore.CreateAsync(
                Guid.NewGuid(),
                TraceType,
                new Uri(Constants.StoreName),
                new PropertyManagerWrapper(), retryPolicyFactory).GetAwaiter().GetResult();

            var configSection            = new ConfigSection(TraceType, configStore, configSectionName);
            var jobBlockingPolicyManager = JobBlockingPolicyManager.CreateAsync(TraceType, versionedPropertyStore).GetAwaiter().GetResult();
            var jobImpactManager         = new JobImpactManager(configSection, new ServiceFabricQueryClient(TraceType));

            var coordinator = new WindowsAzureInfrastructureCoordinator(
                AzureHelper.GetTenantId(configSection),
                managementClient,
                agent,
                configStore,
                configSectionName,
                partitionId,
                replicaId,
                new ServiceFabricHealthClient(),
                jobBlockingPolicyManager,
                jobImpactManager,
                this.modeDetector);

            return(coordinator);
        }
        public static async Task <IVersionedPropertyStore> CreateAsync(
            Guid activityId,
            TraceType traceType,
            Uri storeName,
            IPropertyManagerWrapper propertyManager,
            IRetryPolicyFactory retryPolicyFactory)
        {
            traceType.Validate("traceType");
            storeName.Validate("storeName");
            propertyManager.Validate("propertyManager");
            retryPolicyFactory.Validate("retryPolicyFactory");

            var store = new VersionedPropertyStore(traceType, storeName, propertyManager, retryPolicyFactory);

            await store.InitializeStoreNameAsync(activityId).ConfigureAwait(false);

            return(store);
        }