public ActionResult <CourseDto> CreateCourseForAuthor(Guid authorId, CourseForCreationDto course) { if (!_libraryRepository.AuthorExists(authorId)) { return(NotFound()); } var courseEntity = _mapper.Map <Course> (course); _libraryRepository.AddCourse(authorId, courseEntity); _libraryRepository.Save(); var courseToReturn = _mapper.Map <CourseDto> (courseEntity); return(CreatedAtRoute("GetCourseForAuthor", new { authorId, id = courseToReturn.Id }, courseToReturn)); }