 
 (defn- start-system
   []
-  (-> (mount/only #{#'uxbox.config/config
-                    #'uxbox.db/datasource
-                    #'uxbox.migrations/migrations})
-      (mount/start)))
+  (mount/start))
 
 (defn- stop-system
   []
   (mount/stop))
 
 (defn- run-importer
-  [directory data]
-  (println "Running importer on:")
-  (pprint data))
+  [conn basedir data]
+  (let [images (:images data)
+        icons (:icons data)]
+    (run! #(process-images-entry conn basedir %) images)))
 
 (defn -main
   [& [path]]
-  (let [[directory data] (read-import-file path)]
+  (let [[basedir data] (read-import-file path)]
     (start-system)
     (try
-      (run-importer directory data)
+      (with-open [conn (db/connection)]
+        (sc/apply-atomic conn run-importer basedir data))
       (finally
         (stop-system)))))

  [conn {:keys [id path] :as image}]
  {:pre [(uuid? id)
         (fs/path? path)]}
  (let [sqlv (sql/delete-image {:id id})]
    @(st/delete storage path)
    (sc/execute conn sqlv)))


         (uuid? collid)
         (uuid? imageid)]}
  (let [filename (fs/base-name localpath)
        storage media/images-storage
        [width height] (time (retrieve-image-size localpath))
        extension (second (fs/split-ext filename))
        path @(st/save storage filename localpath)
        params {:name filename
