   (doseq [item (:items transaction)]
     (as-> item i
       (assoc i :transaction-id (:id transaction))
-      (before-save-item i)
       (upsert-item storage i))))
 
 (defn- find-base-item

  ([storage-spec criteria options]
   (first (search-items storage-spec criteria options))))

(defn- recalculate-account-item
  "Accepts a processing context and an item, updates
  the items :index and :balance attributes, and returns

                     [:index :desc]]
              :limit 1}))

(defn- process-items
  "Recalculates and updates statistics in the specifed items"
  [storage account {:keys [index balance] :or {index -1 balance 0M}} items]
  (loop [item (first items)
         remaining (rest items)
         last-index index
         last-balance balance]
    (let [new-index (+ last-index 1)
          new-balance (+ last-balance (polarize-quantity item account))]
      (upsert-item storage (assoc item
                                  :balance new-balance
                                  :index new-index))
      ; TODO if the item does not require updating, exit the loop and return nil
      (if (seq remaining)
        (recur (first remaining)
               (rest remaining)
               new-index
               new-balance)
        [new-index new-balance]))))

(defn- recalculate-account
  "Recalculates statistics for items in the the specified account
  as of the specified date"
