private async void SendMail(object x) { var companyToSend = Companies.Where(c => c.Selected).ToList(); foreach (var item in companyToSend) { var sendAtt = item.SelectedTypeEmail.Equals("OnlyEmail") ? false : true; if (_fileWriter.WriteDocuments(item, sendAtt)) { await _emailService.SendEmail(item, sendAtt); await _companyRepo.SaveCompany(item); Companies.Remove(item); } //_fileWriter.DeleteCompanyFolder(item.Name); } OnPropertyChanged("Companies"); }