public IActionResult Post([FromBody] ReportViewModel model) { var report = new Report { Date = model.Date, GroupId = model.GroupId }; _report_repository.Upsert(report); model.Id = report.Id; foreach (var avm in model.Attendees) { var attendee = new Attendee { Id = avm.AttendeeId, Name = avm.Name }; _attendee_repository.Upsert(attendee); var report_attendee = new ReportAttendee { AttendeeId = attendee.Id, ReportId = report.Id, }; _report_attendee_repository.Upsert(report_attendee); } return(new ObjectResult(model)); }