         (update-in [:account-id] #(Integer. %))
         (dissoc :credit-amount :debit-amount))))
 
+(defn- items-for-form
+  [transaction]
+  (map-indexed #(->> %2
+                        ->form-item
+                        (item-row (:entity-id transaction) %1))
+               (concat (:items transaction)
+                       (repeat {:action nil
+                                :account-id nil
+                                :amount nil}))))
+
 (defn- form-fields
   [transaction]
   (html

        (hidden-input-element (str "id-" index) id))
      (select-element (str "account-id-" index)
                      (:account-id item)
                      (account-options entity-id)
                      {:suppress-label? true}))]
   [:td.col-sm-2
    (text-input-element (str "credit-amount-" index) (:credit-amount item) {:suppress-label? true})]

                     indexed-attr (map #(keyword (str (name %) "-" index)) attr)
                     item (zipmap attr (map #(% params) indexed-attr))]
                 item))) 
       (take-while #(or (integer? (:account-id %)) (seq (:account-id %))))
       (map ->transaction-item)))

(defn create
