//public async Task LoadItemsAsync()
        //{
        //    Departments = new BindableCollection<DepartmentModel>(await _companyAccess.Departments(CurrentCompany));
        //    //Departments.CollectionChanged += HandleItemChange;

        //    NotifyOfPropertyChange(() => Departments);
        //}

        public async Task LoadWorkPeriods()
        {
            Debug.WriteLine("Loading departments...");
            //WorkPeriods = new BindableCollection<WorkPeriodModel>(await _companyAccess.FetchWorkPeriodsAsync(SelectedDepartment));
            var workPeriods = await _companyAccess.FetchWorkPeriodsAsync(SelectedDepartment);

            var users = workPeriods.SelectMany(wp => wp.AssignedUsers);

            WorkPeriods = new BindableCollection <UserModel>(users);
            Debug.WriteLine($"Loaded {WorkPeriods.Count()} departments.");
            NotifyOfPropertyChange(() => Departments);
            NotifyOfPropertyChange(() => WorkPeriods);
        }
        private async Task LoadDepartments()
        {
            var departments = await _access.Departments(CurrentCompany);

            foreach (var department in departments)
            {
                department.WorkPeriods = await _access.FetchWorkPeriodsAsync(department);
            }

            Departments = new BindableCollection <DepartmentModel>(departments);
            NotifyOfPropertyChange(() => Departments);
        }