/// <summary>
        /// Filters the Prescriptions property according to the selected filter.
        /// </summary>
        /// <param name="filter">The user's selected filter</param>
        private void FilterList(MedicineListFilter filter)
        {
            switch (filter)
            {
            case MedicineListFilter.All:
                Prescriptions = AllPrescriptions;
                NullPrescriptionsContentLabel = "No medicines found. Add one?";
                break;

            case MedicineListFilter.Scheduled:
                Prescriptions = ScheduledPrescriptions;
                NullPrescriptionsContentLabel = "No scheduled medicines found. Add one?";
                break;

            case MedicineListFilter.Administered:
                var administered = AdministeredPrescriptions.OrderByDescending(grp => grp.TimeStamp);
                Prescriptions = new ObservableCollection <PrescriptionGroup>(administered);
                NullPrescriptionsContentLabel = "No medicines administered yet.";
                break;

            case MedicineListFilter.Unadministered:
                var unadministered = UnadministeredPrescriptions.OrderByDescending(grp => grp.TimeStamp);
                Prescriptions = new ObservableCollection <PrescriptionGroup>(unadministered);
                NullPrescriptionsContentLabel = "You have not missed any medicines to administer.";
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Divides the prescriptions into their own respective classifications.
        /// </summary>
        private void DividePrescriptions()
        {
            if (ScheduledPrescriptions == null)
            {
                ScheduledPrescriptions = new ObservableCollection <PrescriptionGroup>();
            }
            if (AdministeredPrescriptions == null)
            {
                AdministeredPrescriptions = new ObservableCollection <PrescriptionGroup>();
            }
            if (UnadministeredPrescriptions == null)
            {
                UnadministeredPrescriptions = new ObservableCollection <PrescriptionGroup>();
            }
            if (SelectedPrescriptions == null)
            {
                SelectedPrescriptions = new ObservableCollection <PrescriptionGroup>();
            }

            // past v. future for scheduled
            List <PrescriptionGroup> recentPast;

            try
            {
                recentPast = AllPrescriptions.Where(grp => (((grp.TimeStamp - DateTime.Now).TotalMinutes > -30) && ((grp.TimeStamp - DateTime.Now).TotalMinutes < 0))).ToList();
            }
            catch (ArgumentNullException)
            {
                recentPast = new List <PrescriptionGroup>();
            }

            List <PrescriptionGroup> future;

            try
            {
                future = AllPrescriptions.Where(grp => (grp.TimeStamp - DateTime.Now).TotalMinutes > 0).ToList();
            }
            catch (ArgumentNullException)
            {
                future = new List <PrescriptionGroup>();
            }
            var oc = recentPast.Union(future);

            ScheduledPrescriptions = new ObservableCollection <PrescriptionGroup>(oc);

            // selected
            var selected = AllPrescriptions.Where(grp => grp.IsSelectedOnly).ToList();

            SelectedPrescriptions = new ObservableCollection <PrescriptionGroup>(selected);
            SelectedPrescriptions.CollectionChanged += SelectedPrescriptions_CollectionChanged;

            // administered v. unadministered
            try
            {
                foreach (PrescriptionGroup group in AllPrescriptions)
                {
                    bool isAdministered = false;
                    foreach (var med in group.Prescriptions)
                    {
                        if (med.AdministeredOn.HasValue)
                        {
                            isAdministered = true;
                            break;
                        }
                    }

                    if (isAdministered)
                    {
                        AdministeredPrescriptions.Add(group);
                    }
                    else
                    {
                        UnadministeredPrescriptions.Add(group);
                    }
                }
            }
            catch (Exception)
            {
            }
        }