public List<ManufacturerRatingDto> getAverageCarRatings(List<RatingDto> ratingDtos) {
HashMap<String, AveragingCounter> averages = new HashMap<>();
for (RatingDto ratingDto : ratingDtos) {
CarDto carDto = ratingDto.getCar();
ManufacturerDto manufacturer = carDto.getManufacturer();
String manufacturerName = manufacturer.getName();
Double rating = Double.valueOf(ratingDto.getRating());
if (averages.containsKey(manufacturerName)) {
averages.get(manufacturerName).add(rating);
} else {