public ActionResult EditCourse(UserInformation user, CourseDetails details)
        {
            if (user != null)
            {
                if (user.IsStudent)
                {
                    return View("Students limitations");
                }
                else
                {
                    try
                    {
                        foreach (var item in details.Topics)
                        {
                            _repository.SaveTopic(new CourseTopic() { ID = item.ID, CourseId = item.CourseId, Name = item.TopicName, OrderNumber = item.OrderNumber });
                        }
                        return RedirectToAction("EditCourse", new { ID = details.CourseId });
                    }
                    catch (Exception e)
                    {
                        return View("Error");
                    }

                }
            }
            else return View("UnauthorizedAccess");
        }
        public ActionResult EditCourse(UserInformation user, Guid ID)
        {
            if (user != null)
            {
                if (user.IsStudent)
                {
                    return View("Students limitations");
                }
                else
                {
                    try
                    {
                        if (!CheckIfLecturerCanAccessTheCourse(user, ID))
                            return View("AccessDenied");
                        else
                        {
                            CourseDetails details = new CourseDetails();
                            var course = _repository.Courses.Where(x => x.ID == ID).ToList();
                            if (course.Count() != 0)
                            {
                                details.CourseId = course.First().ID;
                                details.CourseName = course.First().Name;
                                details.Topics = (from x in _repository.CourseTopics where x.CourseId == details.CourseId select new Topic { TopicName = x.Name, ID = x.ID, CourseId = x.CourseId, OrderNumber = x.OrderNumber }).OrderBy(x => x.OrderNumber).ToList<Topic>();
                                for (int i = 0; i < details.Topics.Count; i++)
                                {
                                    Guid topicId = details.Topics[i].ID;
                                    details.Topics[i].LecturesCount = _repository.Lectures.Where(x => x.TopicId == topicId).Count();
                                    details.Topics[i].TestsCount = _repository.Tests.Where(x => x.TopicId == topicId).Count();
                                }
                                //details.Topics = _repository.CourseTopics.Where(x => x.CourseId == details.CourseId);
                            }

                            return View(details);
                        }
                    }
                    catch (Exception e)
                    {
                        return View("Error");
                    }

                }
            }
            else return View("UnauthorizedAccess");
        }