public List <HistoryRangeModel> GetWeek(DateTime start)
        {
            if (null == ProfileManager.Instance.CurrentProfile)
            {
                return(null);
            }

            if (DateTime.MinValue < start && start < DateTime.MaxValue)
            {
                // Always align with start of the week
                start = start.DayOfWeek != DayOfWeek.Sunday ? start.StartOfWeek(DayOfWeek.Sunday) : start;

                // Always check for existing bounds
                if (start < GetMinDate())
                {
                    start = GetMinDate();
                }

                if (start > GetMaxDate())
                {
                    start = GetMaxDate();
                }

                DateTime end = start + TimeSpan.FromDays(7);

                IEnumerable <HistoryModel> sessions = from s in _sessions
                                                      where ((s.StartTime >= start) && (s.EndTime <= end))
                                                      orderby(s.StartTime)
                                                      select s;

                List <HistoryRangeModel> ranges = new List <HistoryRangeModel>();

                // Total summary:
                HistoryRangeModel range = new HistoryRangeModel();
                range.Process(sessions, start, Timeframe.Week, null);
                ranges.Add(range);

                if (0 < ProfileManager.Instance.CurrentProfile?.Babies?.Count)
                {
                    // Summary for each child:
                    foreach (BabyModel baby in ProfileManager.Instance.CurrentProfile.Babies)
                    {
                        range = new HistoryRangeModel();

                        range.Process(sessions, start, Timeframe.Week, baby.Id);

                        ranges.Add(range);
                    }
                }
                return(ranges);
            }

            return(null);
        }
        public HistoryRangeModel GetMonth(DateTime start)
        {
            HistoryRangeModel range = new HistoryRangeModel();
            int      daysInMonth    = DateTime.DaysInMonth(start.Year, start.Month);
            DateTime end            = start + TimeSpan.FromDays(daysInMonth);

            IEnumerable <HistoryModel> sessions = from s in _sessions
                                                  where ((s.StartTime >= start) && (s.EndTime <= end))
                                                  select s;

            range.Process(sessions, start, Timeframe.Month, null);

            return(range);
        }