async Task GetDepartments()
        {
            try
            {
                this.IsRefreshing = true;

                var connection = await DepartmentsService.CheckConnection();

                if (!connection)
                {
                    this.IsRefreshing = false;
                    await Application.Current.MainPage.DisplayAlert("Error", "No internet connection", "Cancel");

                    return;
                }

                var listDepartments = await DepartmentsService.GetAll(Endpoints.GET_Departments);

                this.Departments  = new ObservableCollection <DepartmentsDTO>(listDepartments);
                this.IsRefreshing = false;
            }
            catch (Exception ex)
            {
                this.IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "Cancel");
            }
        }
        async Task CreateDepartment()
        {
            try
            {
                if (string.IsNullOrEmpty(this.Name))
                {
                    await Application.Current.MainPage.DisplayAlert("Error", "You must enter the field title", "Cancel");

                    return;
                }

                this.IsRunning = true;
                this.IsEnabled = false;

                var connection = await departmentsService.CheckConnection();

                if (!connection)
                {
                    this.IsRunning = false;
                    this.IsEnabled = true;

                    await Application.Current.MainPage.DisplayAlert("Error", "No internet connection", "Cancel");

                    return;
                }

                var departmentDTO = new DepartmentsDTO {
                    Name = this.Name, StartDate = this.StartDate, Budget = this.Budget, InstructorID = this.InstructorID
                };
                await departmentsService.Create(Endpoints.POST_Departments, departmentDTO);

                this.IsRunning = false;
                this.IsEnabled = true;

                await Application.Current.MainPage.DisplayAlert("Message", "The process is successful", "Cancel");

                this.DepartmentID = this.InstructorID = 0;
                this.Budget       = 0;
                this.Name         = string.Empty;
                //this.StartDate = DateTime.Now;

                //Application.Current.MainPage = new NavigationPage(new CoursesPage());
            }
            catch (Exception ex)
            {
                this.IsRunning = false;
                this.IsEnabled = true;

                await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "Cancel");
            }
        }