public ActionResult Create(FixtureViewModel model) { try { if (ModelState.IsValid) { model.Validate(); // TODO Ideally a service should do this model.Fixture = model.MapToFixture( model.Fixture, this.competitionService.GetTeamLeagueByTeamIdInCurrentSeason(model.HomeTeamId), this.competitionService.GetTeamLeagueByTeamIdInCurrentSeason(model.AwayTeamId), model.Referee1Id.HasValue ? this.refereeService.Get(model.Referee1Id.Value) : null, model.Referee2Id.HasValue ? this.refereeService.Get(model.Referee2Id.Value) : null, this.membershipService.GetLoggedInUser(), model.OneOffVenueId.HasValue ? oneOffVenueService.Get(model.OneOffVenueId.Value) : null); if (model.Fixture.IsCupFixture) { model.Fixture.Cup = cupService.Get(model.LeagueOrCupId); } fixtureService.Save(model.Fixture); fixtureService.Commit(); SuccessMessage(FormMessages.SaveSuccess); if (model.CreateAnotherFixture) { return(RedirectToAction("Create", new { leagueOrCupId = model.LeagueOrCupId, isCup = model.Fixture.IsCupFixture })); } else { return(RedirectToAction("Index")); } } } catch (FixtureTeamsTheSameException) { ErrorMessage(FormMessages.FixtureTeamsTheSame); } PopulateStaticData(model); return(View(model)); }