public ActionResult EditExams([Bind(Include = "StudentGroup,Exams")] StudentGroupEditExamsViewModel viewModel)
        {
            if (viewModel == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var studentGroupID = viewModel.StudentGroup?.Id;

            if (studentGroupID != null)
            {
                var studentGroup = _studentGroupService.GetByID((int)studentGroupID);
                foreach (var examViewModel in viewModel.Exams)
                {
                    var exam = _examCoreService.GetByID(examViewModel.Id);

                    if (examViewModel.IsAssociatedToStudentGroup == true)
                    {
                        _examCoreStudentGroupService.AssociateExamToStudentGroup(exam, studentGroup);
                    }
                    else if (examViewModel.IsAssociatedToStudentGroup == false)
                    {
                        _examCoreStudentGroupService.DisassociateExamFromStudentGroup(exam, studentGroup);
                    }
                }
            }

            return(RedirectToAction("Details", new { id = studentGroupID }));
        }