public static IEnumerable <CsvCourseRow> FromModel(Course row, IReadOnlyCollection <Region> allRegions) => row.CourseRuns .OrderBy(x => x.StartDate) .ThenBy(x => x.DeliveryMode) .Select(courseRun => new CsvCourseRow() { LearnAimRef = row.LearnAimRef, WhoThisCourseIsFor = row.CourseDescription, EntryRequirements = row.EntryRequirements, WhatYouWillLearn = row.WhatYoullLearn, HowYouWillLearn = row.HowYoullLearn, WhatYouWillNeedToBring = row.WhatYoullNeed, HowYouWillBeAssessed = row.HowYoullBeAssessed, WhereNext = row.WhereNext, CourseName = courseRun.CourseName, ProviderCourseRef = courseRun.ProviderCourseId, DeliveryMode = ParsedCsvCourseRow.MapDeliveryMode(courseRun.DeliveryMode), StartDate = ParsedCsvCourseRow.MapStartDate(courseRun.StartDate), FlexibleStartDate = ParsedCsvCourseRow.MapFlexibleStartDate(courseRun.FlexibleStartDate), VenueName = courseRun.VenueName, ProviderVenueRef = courseRun.ProviderVenueRef, NationalDelivery = ParsedCsvCourseRow.MapNationalDelivery(courseRun.National), SubRegions = ParsedCsvCourseRow.MapSubRegions(courseRun.SubRegionIds, allRegions), CourseWebPage = courseRun.CourseWebsite, Cost = ParsedCsvCourseRow.MapCost(courseRun.Cost), CostDescription = courseRun.CostDescription, Duration = ParsedCsvCourseRow.MapDuration(courseRun.DurationValue), DurationUnit = ParsedCsvCourseRow.MapDurationUnit(courseRun.DurationUnit), StudyMode = ParsedCsvCourseRow.MapStudyMode(courseRun.StudyMode) ?? "", AttendancePattern = ParsedCsvCourseRow.MapAttendancePattern(courseRun.AttendancePattern) ?? "" });