public ActionResult BeginCreate(EducationPlanViewModel viewModel)
        {
            //Checks that all field in the form the user posted was provided by the user.
            if (ModelState.IsValid)
            {
                //Nothing can be persisted yet, because the education plan is not yet fully supplied by the user.
                Session["EducationPlan"] = viewModel;
                IEnumerable<HeadlineModel> models;
                using (var repository = new EducationPlanRepository())
                {
                    models = repository.GetHeadlinesForGroupId(viewModel.GroupId);
                    //if no hedlines are found http status code 404 is returned.
                    if (models == null)
                    {
                        return HttpNotFound();
                    }
                    //Translates the models into apropriate viewmodels
                    List<HeadlineViewModel> headlineViewModels = Mapper.Map<IEnumerable<HeadlineModel>, List<HeadlineViewModel>>(models);
                    //The actual text under each headline is saved in the junction table between the headline table and the education plan table.
                    IEnumerable<EducationPlanToHeadlineViewModel> educationToHeadlineViewModels =
                        headlineViewModels.Select(hvm => new EducationPlanToHeadlineViewModel { HeadLineId = hvm.Id, Headline = hvm });
                    return View("Create", educationToHeadlineViewModels.ToList());
                }

            }
            //if some fields were left empty the user is prompted to enter text into those fields as well.
            return View(viewModel);
        }