public ActionResult Create(CreateSquawkViewModel model) { if (ModelState.IsValid) { Squawk squawk = new Squawk() { AircraftId = model.AircraftId, Subject = model.Subject, Description = model.Description, GroundAircraft = model.GroundAircraft, PostedById = ProfileCommon.GetProfile().MemberId, PostedOn = DateTime.Now, Status = SquawkStatus.Open.ToString() }; _dataService.AddSquawk(squawk); if (model.GroundAircraft) { _dataService.UpdateAircraftStatus(model.AircraftId, AircraftStatus.Grounded.ToString()); } try { Aircraft aircraft = _dataService.GetAircraftById(model.AircraftId); MailMessage message = new MailMessage(); message.Subject = "Squawk posted for " + aircraft.RegistrationNumber; message.From = new MailAddress("*****@*****.**"); message.Body = model.Subject + "\t"; message.Body += model.Description; List <Member> owners = _dataService.GetAircraftOwners(model.AircraftId); foreach (var owner in aircraft.Owners) { message.To.Add(new MailAddress(owner.Login.Email)); } SendEmail(message); } catch (Exception ex) { LogError("Error while sending squawk notification email for aircraftId " + model.AircraftId + "\t" + ex.ToString()); } return(RedirectToAction("ListActiveSquawks")); } return(View(model)); }