public ActionResult EditTopic(UserInformation user, Guid topicId)
        {
            if (user != null)
            {
                if (user.IsStudent)
                {
                    return View("Students limitations");
                }
                else
                {
                    try
                    {
                        if (!CheckIfLecturerHasAccessToTheTopic(user, topicId))
                            return View("AccessDenied");
                        else
                        {
                            TopicForEditing t = new TopicForEditing();
                            t.ID = topicId;
                            t.CourseId = _repository.CourseTopics.Where(x => x.ID == topicId).First().CourseId;
                            ViewBag.CourseName = _repository.Courses.Where(x => x.ID == t.CourseId).First<Course>().Name;
                            ViewBag.TopicName = _repository.CourseTopics.Where(x => x.ID == topicId).First().Name;
                            t.Lectures = _repository.Lectures.Where(x => x.TopicId == topicId).ToList<Lecture>().OrderBy(x => x.OrderNumber).ToList<Lecture>();
                            t.Tests = _repository.Tests.Where(x => x.TopicId == topicId).ToList<Test>();
                            return View(t);
                        }
                    }
                    catch (Exception e)
                    {
                        return View("Error");
                    }

                }
            }
            else return View("UnauthorizedAccess");
        }
 public ActionResult EditTopic(UserInformation user, TopicForEditing topic)
 {
     SaveReorderedLectures(topic.Lectures);
     return RedirectToAction("EditTopic", new { topicId = topic.ID });
 }