public async Task <JsonResult> AddPerson(ActivityLogPersonCreateViewModel model) { if (ModelState.IsValid) { try { int id = await ActivityService.CreatePerson(model); ActivityLogParticipantModel participant = new ActivityLogParticipantModel() { Person = new ActivityLogPersonModel() { Id = id, FullName = model.FullName, PhoneNumber = model.PhoneNumber, Description = model.Description, Email = model.Email, SessionId = model.SessionId }, Type = (ActivityLogParticipantTypes)model.Type }; ActivityService.AddParticipantToSession(Session, model.SessionId, participant); return(Json(new { Success = true, Message = string.Empty, Id = id })); } catch (Exception e) { MvcApplication.LogException(e); return(Json(new { Success = false, Message = "There was an error saving. It has been logged for later review.", Id = 0 })); } } return(Json(new { Success = false, Message = "Invalid form", Id = 0 })); }