public static async Task Run(
            [TimerTrigger("0 * * * * *")] TimerInfo myTimer,
            [OrchestrationClient] DurableOrchestrationClient client,
            [Microsoft.Azure.WebJobs.Table("MetricDatas", "Metrics", "001")] MetricData data,
            IAsyncCollector <MetricData> table,
            ILogger log)
        {
            log.LogMetricsCollector($"Executed at: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");

            var t = await client.GetStatusAsync(InstanceId);

            var content = JsonConvert.DeserializeObject <Content>(data.Content);

            if (IsStarted)
            {
                log.LogMetricsCollector("Get active message.");
                var currentActiveMessageCount = AzureHelpers.GetCurrentMetrics();

                log.LogMetricsCollector($"Current message count: {currentActiveMessageCount}");

                log.LogMetricsCollector($"Calculate current part metrics.");

                var currentDayActiveMessageCount = currentActiveMessageCount - content.MessageCount;

                content.MessageCount = currentActiveMessageCount;
                content.AddData(currentActiveMessageCount);
                var @event = new MetricCollected(currentDayActiveMessageCount);

                data.Content = JsonConvert.SerializeObject(content);
                await table.AddAsync(data);

                log.LogMetricsCollector($"Raise event to scaling function.");
                await client.RaiseEventAsync(InstanceId, nameof(MetricCollected), @event);

                log.LogMetricsCollector("Done.");
            }
            else
            {
                AutoregresiveParam = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.AutoregresiveParam));
                IntegrationParam   = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.IntegrationParam));
                MoveAverrageParam  = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.MoveAverrageParam));
                Period             = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.Period));
                Q = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.Q));
                var costForPeriod = EnvironmentHelpers.GetDoubleEnvironmentParameter("CostForPeriod");
                CostOfOneMachine = EnvironmentHelpers.GetIntegerEnvironmentParameter(nameof(MasterPerformMetricsCollector.CostOfOneMachine));

                log.LogMetricsCollector($"Start first forecasting.");
                IsStarted  = true;
                InstanceId = await client.StartNewAsync(nameof(ScalingFunction), new ScalingState(content.Data, costForPeriod));
            }
        }