protected async Task ExecuteSearchCommand() { if (IsBusy) { return; } IsBusy = true; GroupedDonationList.Clear(); var donations = await _donationService.ListDonationsByLanguageAndNameAsync(_query); if (donations != null && donations.Count > 0) { var donationsDads = donations.Where(c => c.idDonationsDad == null); foreach (var itemDad in donationsDads) { if (itemDad.names.Count > 0) { var groupName = itemDad.names[0].name; var newGroup = new GroupModelCollection <Donation>(groupName, groupName.Substring(0, 1)) { }; var donationsDadSons = donations.Where(c => c.idDonationsDad == itemDad.idDonations); newGroup.GroupCount = donationsDadSons.Count(); foreach (var itemDadSon in donationsDadSons) { if (itemDadSon.names.Count > 0) { newGroup.Add(new Donation() { Id = itemDadSon.idDonations, Name = itemDadSon.names[0].name, Icon = "tab_about.png", Img = itemDadSon.img }); } } GroupedDonationList.Add(newGroup); } } } else { await Application.Current.MainPage.DisplayAlert("Query", "Donations not found", "Ok"); } IsBusy = false; }