private Map<Album, Map<ImageType, Resource>> collectAlbumTargets(
     Library library, final ResourceLocator resourceLocator, Collection<Album> changedAlbums) {
   Map<Album, Map<ImageType, Resource>> result = new HashMap<>();
   for (Album album : library.getAlbums()) {
     Resource artworkAssetResource = album.artworkAssetResource();
     if (artworkAssetResource != null) {
       Map<ImageType, Resource> targets = new HashMap<ImageType, Resource>();
       for (ImageType type : ImageType.values()) {
         String imagePath = resourceLocator.getAlbumImagePath(album, type);
         if (imagePath != null) {
           Resource resource = resourceLocator.getResource(imagePath);
           try {
             if (changedAlbums.contains(album) || !resource.exists()) {
               resource.getParent().mkdirs();
               targets.put(type, resource);
             }
           } catch (IOException e) {
             LOGGER.warning("Could not write image file: " + resource.getPath().toAbsolutePath());
           }
         }
       }
       if (!targets.isEmpty()) {
         result.put(album, targets);
       }
     }
   }
   return result;
 }