public GetCourseScheduleRespond SetScheduleWithWeek(SetScheduleWithWeekRequest body)
        {
            var areArgumentsValid = body != null
                && !string.IsNullOrEmpty(body.UserProfileId)
                && !string.IsNullOrEmpty(body.ClassRoomId);
            if (!areArgumentsValid) return null;

            var canAccessToCourse = validateAccessToCourseScheduleManagement(body.UserProfileId, body.ClassRoomId);
            if (!canAccessToCourse) return null;

            var classCalendar = _classCalendarRepo.GetClassCalendarByClassRoomId(body.ClassRoomId);
            if (classCalendar == null) return null;

            var isRequestValid = classCalendar.BeginDate.HasValue && classCalendar.ExpiredDate.HasValue;
            if (isRequestValid)
            {
                var beginDate = classCalendar.BeginDate.Value.ToUniversalTime();
                var endedDate = classCalendar.ExpiredDate.Value.ToUniversalTime();

                const int ShiftTwoDays = 2;
                var diffDays = (int)(Math.Abs((beginDate - endedDate).TotalDays) + ShiftTwoDays);
                var dateRange = Enumerable.Range(0, diffDays).Select(it => beginDate.AddDays(it));

                classCalendar.Holidays = classCalendar.Holidays ?? Enumerable.Empty<DateTime>();
                classCalendar.ShiftDays = classCalendar.ShiftDays ?? Enumerable.Empty<DateTime>();

                if (body.IsSunday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Sunday, dateRange);
                if (body.IsMonday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Monday, dateRange);
                if (body.IsTuesday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Tuesday, dateRange);
                if (body.IsWednesday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Wednesday, dateRange);
                if (body.IsThursday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Thursday, dateRange);
                if (body.IsFriday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Friday, dateRange);
                if (body.IsSaturday) setHolidayAndShiftDate(classCalendar, body, DayOfWeek.Saturday, dateRange);

                classCalendar.Holidays = classCalendar.Holidays.Distinct();
                classCalendar.ShiftDays = classCalendar.ShiftDays.Distinct();

                classCalendar.CalculateCourseSchedule();
                _classCalendarRepo.UpsertClassCalendar(classCalendar);
            }

            var result = getCourseSchedule(classCalendar, isRequestValid);
            return result;
        }
 private void setHolidayAndShiftDate(ClassCalendar classCalendar, SetScheduleWithWeekRequest body, DayOfWeek day, IEnumerable<DateTime> dateRange)
 {
     var qry = dateRange.Where(it => it.DayOfWeek == day);
     classCalendar.Holidays = body.IsHoliday ? classCalendar.Holidays.Union(qry) : classCalendar.Holidays.Except(qry);
     classCalendar.ShiftDays = body.IsShift ? classCalendar.ShiftDays.Union(qry) : classCalendar.ShiftDays.Except(qry);
 }
 public GetCourseScheduleRespond SetScheduleWithWeek(SetScheduleWithWeekRequest body)
 {
     // TODO: Not implemented 
     throw new NotImplementedException();
 }