public ActionResult SaveLecture(UserInformation user, LectureForEditing lecture) { if (user != null) { if (user.IsStudent) { return View("Students limitations"); } else { try { if (!ModelState.IsValid) return View("EditLecture", lecture); else { Lecture lect = new Lecture() { ID = lecture.ID, Name = lecture.Name, TopicId = lecture.TopicId, OrderNumber = lecture.OrderNumber, Homework = lecture.Homework, LectureContent = lecture.LectureContent }; _repository.SaveLecture(lect); return RedirectToAction("EditTopic", "Topic", new { topicId = lecture.TopicId }); } } catch (Exception e) { return View("Error"); } } } else return View("UnauthorizedAccess"); }