/// <summary>
        /// ######### ######### # #########
        /// </summary>
        /// <param name="previousSelectedDay">###### ### # #########</param>
        /// <returns>##/###</returns>
        protected bool SaveChangesToStore(DayInCalendarObject previousSelectedDay)
        {
            bool isDiffFromParent  = GetIsCurrentDayDiffFromParent();
            bool wasDiffFromParent = GetIsDiffFromParent(previousSelectedDay);
            Guid dayInCalendarId   = previousSelectedDay.Id;
            bool isUpdated         = true;

            if (!isDiffFromParent && wasDiffFromParent)
            {
                ChangesStore.AddRemovedDay(previousSelectedDay);
            }
            else if (isDiffFromParent && !wasDiffFromParent)
            {
                var newDay = (DayInCalendarObject)previousSelectedDay.Clone();
                newDay.Id                 = Guid.NewGuid();
                newDay.DayTypeId          = (Guid)DayTypeEdit.Value;
                newDay.CalendarId         = _page.DataSource.ActiveRowPrimaryColumnValue;
                newDay.IsCalendarDayValue = IsCalendarDayValue;
                ChangesStore.AddNewDay(newDay);
                dayInCalendarId = newDay.Id;
                ChangedWorkingTimeIntervalsIndexes = GetChagedTimeIntervalIndexesFromFilledControls().ToList();
                CurrentWorkingTimeIntervalsData.Clear();
            }
            else if (isDiffFromParent && NeedUpdateDayInCalendarData(previousSelectedDay))
            {
                previousSelectedDay.DayTypeId = (Guid)DayTypeEdit.Value;
                ChangesStore.AddChangedDay(previousSelectedDay);
            }
            else
            {
                isUpdated = false;
            }
            UpdateIntervals(dayInCalendarId);
            return(isUpdated);
        }
 /// <summary>
 /// ######### #########
 /// </summary>
 /// <param name="dayInCalendarId">############# ### # #########</param>
 private void UpdateIntervals(Guid dayInCalendarId)
 {
     foreach (int i in ChangedWorkingTimeIntervalsIndexes)
     {
         var container = _page.PageContainer;
         var fromDate  =
             (DateTimeEdit)
             container.FindControl(string.Format(FromControlNameFormat, TimeIntervalTypeControlAlias, i));
         var toDate =
             (DateTimeEdit)
             container.FindControl(string.Format(ToControlNameFormat, TimeIntervalTypeControlAlias, i));
         var  minDate = DateTime.MinValue;
         bool isIntervalControlsFilled          = fromDate.SelectedDate != minDate && toDate.SelectedDate != minDate;
         WorkingTimeIntervalObject timeInterval = CurrentWorkingTimeIntervalsData
                                                  .SingleOrDefault(t => t.Index == i);
         if (isIntervalControlsFilled && timeInterval != null)
         {
             timeInterval.From = fromDate.SelectedDate;
             timeInterval.To   = toDate.SelectedDate;
             ChangesStore.AddChangedInterval(timeInterval);
         }
         else if (isIntervalControlsFilled)
         {
             var newTimeInterval = new WorkingTimeIntervalObject {
                 Id              = Guid.NewGuid(),
                 Index           = i,
                 DayInCalendarId = dayInCalendarId,
                 From            = fromDate.SelectedDate,
                 To              = toDate.SelectedDate
             };
             ChangesStore.AddNewInterval(newTimeInterval);
         }
         else if (timeInterval != null)
         {
             ChangesStore.AddRemovedInterval(timeInterval);
         }
     }
 }