public List<Course> GenerateCourses(int coursesCount)
        {
            var courses = new List<Course>();

            for (int i = 0; i < coursesCount; i++)
            {
                var course = new Course();
                course.Name = "Course #" + i;
                course.Description = "Description #" + i;
                course.Materials = "Materials #" + i;
                courses.Add(course);
            }

            return courses;
        }
        public IHttpActionResult Post(CourseRequestModel model)
        {
            if (!this.ModelState.IsValid || model == null)
            {
                return this.BadRequest(this.ModelState);
            }

            var courseToAdd = new Course()
            {
                Name = model.Name,
                Description = model.Description,
                Materials = model.Materials,
            };

            foreach (var homeworkId in model.HomeworkIds)
            {
                var currentHomework = this.homeworks
                    .All()
                    .FirstOrDefault(h => h.Id == homeworkId);

                if (currentHomework != null)
                {
                    courseToAdd.Homeworks.Add(currentHomework);
                }
            }

            foreach (var studentId in model.StudentIds)
            {
                var currentStudent = this.students
                    .All()
                    .FirstOrDefault(s => s.Id == studentId);

                if (currentStudent != null)
                {
                    courseToAdd.Students.Add(currentStudent);
                }
            }

            this.courses.Add(courseToAdd);
            this.courses.SaveChanges();

            return this.Ok();
        }