   or nil if te balance didn't change."
   [storage [account-id base-item]]
   (let [account (accounts/find-by-id storage account-id)
-        items (search-items storage {:account-id account-id
-                                     :transaction-date [:between
-                                                        (:transaction-date base-item)
-                                                        (t/today)]})] ; TODO: use last partition value
-    (reduce (fn [context item]
-              (let [new-index (+ 1 (:last-index context))
-                    polarized-amount (accounts/polarize-amount account (:balance item))
-                    new-balance (+ (:last-balance context)
-                                   polarized-amount)
-                    changed (update-item storage (assoc item :index new-index :balance new-balance))]
-                (assoc context :last-index new-index
-                               :last-balance new-balance)))
-            ; TODO short circuit if no change
-            {:last-index 0
-             :last-balance 0M}
-            items))
-  
-  ; TOTO: return the account-id and the new balance (or nil)
-  )
+        items (search-items storage
+                            {:account-id account-id
+                             :transaction-date [:between
+                                                (:transaction-date base-item)
+                                                (t/today)]} ; TODO: use last partition value
+                            {:sort [:transaction-date :index]})
+        result (reduce (fn [context item]
+                         (let [new-index (+ 1 (:last-index context))
+                               polarized-amount (accounts/polarize-amount item account)
+                               new-balance (+ (:last-balance context)
+                                              polarized-amount)
+                               changed (update-item-index-and-balance
+                                         storage
+                                         (assoc item
+                                                :index new-index
+                                                :balance new-balance))
+                               updated (assoc context
+                                              :last-index new-index
+                                              :last-balance new-balance)]
+                           (if changed
+                             updated
+                             (reduced (dissoc updated :last-balance)))))
+                       {:last-index 0
+                        :last-balance 0M}
+                       items)]
+    (when-let [last-balance (:last-balance result)]
+      (accounts/update storage (assoc account :balance last-balance)))))
 
 (defn- recalculate-items
   "Accepts a list of transaction items and processes items

       (create-transaction-item storage)
       after-item-read))

(defn- update-account-balances
  [& args]

  (pprint {:update-account-balances args}) 

  )

(defn- recalculate-account-items
  "Accepts a tuple containing an account-id and a base item,

      (:balance t)
      0M)))

(defn find-items-by-ids
  [storage-spec ids date-range]
  (search-items
