   (->> (:items transaction)
        (map :account-id)
        (into #{})))
+
+(defn- save-delayed-info
+  [settings {:keys [entity-id transaction-date] :as transaction}]
+  (-> settings
+      (update-in [entity-id :delayed-account-ids]
+                 concat
+                 (extract-account-ids transaction))
+      (update-in [entity-id :earliest-date] #(if %
+                                               (earlier % transaction-date)
+                                               transaction-date))))
 
 (defn create
   "Creates a new transaction"

                   new-balance)
            [new-index new-balance]))))))

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

                      (map before-save-item)
                      (map #(create-transaction-item* s %))))
          (if (delay-balances? (:entity-id validated))
            (swap! ambient-settings #(save-delayed-info % validated))
            (doseq [account-id account-ids]
              (recalculate-account s account-id (:transaction-date validated))))
          (reload s created))))))
