       edegalAlbum =
         path: path.join(parent.path, slug)
         breadcrumb: breadcrumb
-        thumbnail: PLACEHOLDER_IMAGE
         title: coppermineAlbum.title
         description: coppermineAlbum.description
         subalbums: []
         pictures: []
 
-      parent.subalbums.push _.pick edegalAlbum, 'path', 'title', 'thumbnail'
-      convertPictures(coppermineAlbum.aid, edegalAlbum, indent + 1).then -> saveAlbum(edegalAlbum)
+      convertPictures(coppermineAlbum.aid, edegalAlbum, indent + 1).then ->
+        setThumbnail edegalAlbum
+        parent.subalbums.push _.pick edegalAlbum, 'path', 'title', 'thumbnail'
+        saveAlbum edegalAlbum
 
 convertPictures = (albumId, parent, indent=0) ->
   query('SELECT pid, filename, filepath, title, caption FROM cpg11d_pictures WHERE aid = ? ORDER BY position', [albumId]).spread (pictures) ->

        path: path.join(parent.path, sanitizeFilename(copperminePicture.filename) or "picture#{copperminePicture.pid}")
        title: title
        description: copperminePicture.description
        thumbnail: PLACEHOLDER_IMAGE
        media: [ TODO: true ]

if require.main is module

      edegalAlbum =
        path: path.join(parent.path, slug)
        breadcrumb: breadcrumb
        title: coppermineCategory.name
        description: coppermineCategory.description
        subalbums: []
        pictures: []

      albumWork = [
        convertSubcategories(coppermineCategory.cid, edegalAlbum, indent + 1),
        convertAlbums(coppermineCategory.cid, edegalAlbum, indent + 1)
      ]

      Q.all(albumWork).then ->
        setThumbnail edegalAlbum
        parent.subalbums.push _.pick edegalAlbum, 'path', 'title', 'thumbnail'
        saveAlbum(edegalAlbum)

convertAlbums = (categoryId, parent, indent=0) ->
  breadcrumb = makeBreadcrumb parent
