          first)))
 
 (defn- resolve-lot
-  [context model]
+  [model context]
   (update-in model [:lot-id] #(:id (find-lot context %))))
 
 (defn- resolve-transaction-item-ids

        items))

(defn- resolve-reconciliation-transaction-item-ids
  [context reconciliation]
  (update-in reconciliation
             [:item-ids]
             #(resolve-transaction-item-ids context
                                            (:account-id reconciliation)
                                            %)))

(defn- create-reconciliations
  [storage context reconciliations]
  (mapv (fn [attributes]
          (->> attributes
               (resolve-account context)
               (resolve-reconciliation-transaction-item-ids context)
               (reconciliations/create storage)
               throw-on-invalid))
        reconciliations))

(defn- realize-reconciliations
  [storage context]
  (update-in context [:reconciliations] #(create-reconciliations storage context %)))

(defn- read-file
  [image]
  (update-in image [:body] #(read-bytes %)))

(defn- create-images
  [storage context images]
  (mapv (fn [attributes]
          (->> attributes
               (resolve-user context)
               read-file
               (images/create storage)
               throw-on-invalid))
        images))

(defn- realize-images
  [storage context]
  (update-in context [:images] #(create-images storage context %)))

(defn- find-image

       first))

(defn- resolve-user
  [model context]
  (update-in model [:user-id] #(:id (find-user context %))))

(defn- create-entities
