private async void SaveMember(object sender, EventArgs e) { var form = (Worker)BindingContext; form.BirthDate = birthDate.Date; form.CompanyId = companies[company.SelectedIndex].Id; form.PositionId = positions[position.SelectedIndex].Id; var fields = new List <string>(); var errors = new List <string>(); var errorsList = _worker.IsDataValid(form) .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(error => error.Split(new[] { ';' }, 2)) .Where(combined => !string.IsNullOrWhiteSpace(combined.Last())); foreach (var combined in errorsList) { fields.Add(combined.First()); errors.Add(combined.Last()); } if (!errors.Any()) { _worker.Update(form); errors.Clear(); await Navigation.PopToRootAsync(); } else { for (int i = 0; errors.Count - 1 >= i; i++) { await DisplayAlert(fields[i], errors[i], "OK"); } errors.Clear(); } }