@Override
public void buildSeoEntity(Course course, Locale locale)
throws ServiceNotFoundException, ContextNotActiveException, Exception {
School school = this.serviceLocator.getSchoolService().getSchool(course.getSchool(), locale);
Provider provider = this.serviceLocator.getProviderService().getProviderById(course.getProvider(), locale);
// Territorial data
String townName = school.getContactInfo() != null &&
school.getContactInfo().getCity() != null ?
school.getContactInfo().getCity() : "";
List<Town> towns = this.serviceLocator.getTerritorialService().
findTownsByName(townName, locale);
Town town = new Town();
Province province = new Province();
Region region = new Region();
if(towns != null && towns.size() > 0) {
town = towns.get(0);
region = this.serviceLocator.getTransversalService().getRegionsMap().get(locale.getLanguage()).get(town.getRegion());
province = this.serviceLocator.getTransversalService().getProvincesMap().get(locale.getLanguage()).get(town.getProvince());
}
CourseCatalog catalog = new CourseCatalog(course, locale.getLanguage(),
school, provider.getName(), province.getName(), region.getName(), town.getName());
CourseCatalog catalogOld =
this.serviceLocator.getCatalogService().getCourseCatalogByCourseId(course.getId(), locale);
if(catalogOld != null) {