 
 (defn- find-last-item-before
   [storage-spec account-id date]
-  (with-storage [s storage-spec]
-    (->> (select-transaction-items
-           s
-           {:account-id account-id
-            :transaction-date [:< date]}
-           {:sort [[:t.transaction-date :desc] [:i.index :desc]]
-            :limit 1})
-         first)))
+  (find-item storage-spec
+             {:account-id account-id
+              :transaction-date [:< date]}
+             {:sort [[:t.transaction-date :desc] [:i.index :desc]]}))
 
 (defn- find-last-item-on-or-before
   [storage-spec account-id date]
-  (with-storage [s storage-spec]
-    (first (select-transaction-items s
-                                     {:account-id account-id
-                                      :transaction-date [:<= date]}
-                                     {:sort [[:i.transaction-date :desc] [:i.index :desc]]
-                                      :limit 1}))))
+  (find-item storage-spec
+             {:account-id account-id
+              :transaction-date [:<= date]}
+             {:sort [[:i.transaction-date :desc] [:i.index :desc]]}))
 
 (defn balance-delta
   "Returns the change in balance during the specified period for the specified account"

  [storage transaction-id]
  (select-lots-transactions-by-transaction-id storage transaction-id))

(defn- append-items
  [{:keys [id transaction-date] :as transaction} storage]
  (when transaction
    (assoc transaction
           :items
           (mapv after-item-read
                 (select-transaction-items
                   storage
                   {:transaction-id id
                    :transaction-date transaction-date}
                   {:sort [[:action :desc] [:quantity :desc]]})))))

(defn- append-lot-items
  [transaction storage]

(s/def ::per-page validation/positive-integer?)
(s/def ::select-options (s/keys :req-un [::page ::per-page]))

(defn search
  "Returns the transactions that belong to the specified entity"
  ([storage-spec criteria]
