public ScheduledHorizontalScaleConfiguration[] GetWindowsAzureScheduledHorizontalScaleConfigurations()
        {
            ArrayList list = new ArrayList(StealFocusForecastConfiguration.Instance.WindowsAzure.HostedService.ScheduledHorizontalScales.Count);
            foreach (WindowsAzureScheduledHorizontalScaleConfigurationElement windowsAzureScheduledHorizontalScaleConfigurationElement in StealFocusForecastConfiguration.Instance.WindowsAzure.HostedService.ScheduledHorizontalScales)
            {
                ScheduledHorizontalScaleConfiguration scheduledHorizontalScaleConfiguration = new ScheduledHorizontalScaleConfiguration();
                scheduledHorizontalScaleConfiguration.DeploymentSlot = windowsAzureScheduledHorizontalScaleConfigurationElement.DeploymentSlot;
                scheduledHorizontalScaleConfiguration.Mode = windowsAzureScheduledHorizontalScaleConfigurationElement.Mode;
                scheduledHorizontalScaleConfiguration.PollingIntervalInMinutes = windowsAzureScheduledHorizontalScaleConfigurationElement.PollingIntervalInMinutes;
                scheduledHorizontalScaleConfiguration.ServiceName = windowsAzureScheduledHorizontalScaleConfigurationElement.ServiceName;
                scheduledHorizontalScaleConfiguration.SubscriptionConfigurationId = windowsAzureScheduledHorizontalScaleConfigurationElement.SubscriptionConfigurationId;
                scheduledHorizontalScaleConfiguration.TreatWarningsAsError = windowsAzureScheduledHorizontalScaleConfigurationElement.TreatWarningsAsError;
                foreach (HorizontalScaleConfigurationElement horizontalScaleConfigurationElement in windowsAzureScheduledHorizontalScaleConfigurationElement.HorizontalScales)
                {
                    HorizontalScaleConfiguration horizontalScaleConfiguration = new HorizontalScaleConfiguration
                        {
                            RoleName = horizontalScaleConfigurationElement.roleName,
                            InstanceCount = horizontalScaleConfigurationElement.instanceCount
                        };
                    scheduledHorizontalScaleConfiguration.HorizontalScales.Add(horizontalScaleConfiguration);
                }

                foreach (ScheduleConfigurationElement scheduleConfigurationElement in windowsAzureScheduledHorizontalScaleConfigurationElement.Schedules)
                {
                    ScheduleDefinitionConfiguration scheduleDefinitionConfiguration = GetScheduleDefinitionConfiguration(scheduleConfigurationElement.ScheduleDefinitionName);
                    scheduledHorizontalScaleConfiguration.Schedules.Add(scheduleDefinitionConfiguration);
                }

                list.Add(scheduledHorizontalScaleConfiguration);
            }

            return (ScheduledHorizontalScaleConfiguration[])list.ToArray(typeof(ScheduledHorizontalScaleConfiguration));
        }
        private static HorizontalScale[] GetHorizontalScalesFromHorizontalScaleConfiguration(HorizontalScaleConfiguration[] horizontalScaleConfigurations)
        {
            HorizontalScale[] horizontalScales = new HorizontalScale[horizontalScaleConfigurations.Length];
            for (int i = 0; i < horizontalScaleConfigurations.Length; i++)
            {
                horizontalScales[i] = new HorizontalScale
                    {
                        RoleName = horizontalScaleConfigurations[i].RoleName,
                        InstanceCount = horizontalScaleConfigurations[i].InstanceCount
                    };
            }

            return horizontalScales;
        }