async Task SaveLeague() { IsBusy = true; if (String.IsNullOrWhiteSpace(SelectedSport.Name) || String.IsNullOrWhiteSpace(SelectedSport.Id)) { UserDialogs.Instance.Alert("Please Select a Sport", "Wrong Input"); } else if (String.IsNullOrWhiteSpace(SelectedLeagueType.Name) || String.IsNullOrWhiteSpace(SelectedLeagueType.Id)) { UserDialogs.Instance.Alert("Please Select a League Type", "Wrong Input"); } else if (String.IsNullOrWhiteSpace(LeagueName)) { UserDialogs.Instance.Alert("Please enter a Name", "Wrong Input"); } else if (selectedStartDate > selectedEndDate) { UserDialogs.Instance.Alert("Start date can't be larger than End date", "Wrong Input"); } else { var token = Newtonsoft.Json.JsonConvert.DeserializeObject <Token>(Settings.Token); var organizerCity = Cities.FirstOrDefault(c => c.Id == token.Organizer.CityRefId); var createLeagueDto = new CreateLeagueDto { Name = LeagueName, Description = Description, LeagueType = SelectedLeagueType, Organizer = token.Organizer, Requirements = Requirements, RecLeagueEnd = SelectedEndDate, RecLeagueStart = SelectedStartDate, Sport = SelectedSport, City = organizerCity }; var response = await OrganizerService.CreateLeague(createLeagueDto, token.AuthToken); if (response.Success) { ClearAddOrganizerPage(); await Navigation.PopAsync(); Leagues = new ObservableCollection <League>(response.Leagues); var notificator = DependencyService.Get <IToastNotificator>(); var options = new NotificationOptions() { Title = "Success", Description = "League has been Added", }; var result = await notificator.Notify(options); } else { UserDialogs.Instance.Alert("An error occured while adding the league!", "Error"); } } IsBusy = false; }