public async Task <Response <CourseDto> > Handle(AddCourseCommand request, CancellationToken cancellationToken)
        {
            var course = CreateCourseData(request);
            await _courseRepository.AddAsync(course);

            return(Response <CourseDto> .Success(await _mediator.Send(new GetCourseDetailsQuery {
                CourseId = course.Id
            },
                                                                      cancellationToken)));
        }
 private Course CreateCourseData(AddCourseCommand request)
 {
     return(new Course
     {
         Lessons = request.LessonFieldIds.Select(x => new CourseLessonFieldGradeMapping {
             LessonId = x
         })
                   .ToList(),
         Price = request.Price,
         Description = request.Description,
         Title = request.Title,
         PermaLink = request.Permalink,
         CourseCategoryId = request.CourseCategoryId,
         TeacherId = _workContext.CurrentUserId,
         AdminMessageForTeacher = request.TeacherMessageForAdmin
     });
 }