/// <summary>
        /// Get the execution day
        /// </summary>
        /// <param name="scheduleDay">schedule day</param>
        /// <returns>DaysOfWeekSelector</returns>
        private DaysOfWeekSelector GetExecutionDay(int scheduleDay)
        {
            DaysOfWeekSelector days = new DaysOfWeekSelector();
            switch (scheduleDay)
            {
                case 1:
                    days.Sunday = true;
                    break;
                case 2:
                    days.Monday = true;
                    break;
                case 3:
                    days.Tuesday = true;
                    break;
                case 4:
                    days.Wednesday = true;
                    break;
                case 5:
                    days.Thursday = true;
                    break;
                case 6:
                    days.Friday = true;
                    break;
                case 7:
                    days.Saturday = true;
                    break;
                default:
                    break;
            }

            return days;
        }
        /// <summary>
        /// Create the recurrence pattern according to the schedule Type
        /// </summary>
        /// <param name="scheduleTypeParam"></param>
        /// <returns></returns>
        private RecurrencePattern GetPattern(string scheduleTypeParam, int scheduleDay)
        {
            SchedulePeriod scheduleType = (SchedulePeriod)Enum.Parse(typeof(SchedulePeriod), scheduleTypeParam, true);

            switch (scheduleType)
            {
                case SchedulePeriod.Daily:
                    DailyRecurrence dailyPattern = new DailyRecurrence();
                    dailyPattern.DaysInterval = 1;
                    return dailyPattern;
                case SchedulePeriod.Monthly:
                    MonthlyDOWRecurrence monthlyPattern = new MonthlyDOWRecurrence();
                    monthlyPattern.WhichWeekSpecified = true;
                    monthlyPattern.WhichWeek = WeekNumberEnum.LastWeek;

                    MonthsOfYearSelector months = new MonthsOfYearSelector();
                    months.January = true;
                    months.February = true;
                    months.March = true;
                    months.April = true;
                    months.May = true;
                    months.June = true;
                    months.July = true;
                    months.August = true;
                    months.September = true;
                    months.October = true;
                    months.November = true;
                    months.December = true;
                    monthlyPattern.MonthsOfYear = months;

                    DaysOfWeekSelector days = GetExecutionDay(scheduleDay);
                    monthlyPattern.DaysOfWeek = days;

                    return monthlyPattern;
                case SchedulePeriod.Weekdays:
                    WeeklyRecurrence weekdaysRecurrence = new WeeklyRecurrence();

                    DaysOfWeekSelector Weekdays = new DaysOfWeekSelector();
                    Weekdays.Monday = true;
                    Weekdays.Tuesday = true;
                    Weekdays.Wednesday = true;
                    Weekdays.Thursday = true;
                    Weekdays.Friday = true;

                    weekdaysRecurrence.DaysOfWeek = Weekdays;

                    weekdaysRecurrence.WeeksIntervalSpecified = true;
                    weekdaysRecurrence.WeeksInterval = 1;

                    return weekdaysRecurrence;
                case SchedulePeriod.Weekly:
                    WeeklyRecurrence weeklyRecurrence = new WeeklyRecurrence();

                    DaysOfWeekSelector weeklydays = GetExecutionDay(scheduleDay);
                    weeklyRecurrence.DaysOfWeek = weeklydays;

                    weeklyRecurrence.WeeksIntervalSpecified = true;
                    weeklyRecurrence.WeeksInterval = 1;

                    return weeklyRecurrence;
                default:
                    return null;
            }
        }