              owned? (m/return
                       (applied-or-owned?
                        model
-                       (t/extract-uber-key-value model record)
+                       (t/extract-uber-key-value model unique-key-record)
                        insert-response))
 
              live-ref? (if-not owned?

                                   :key-value key-value}
                                  reason]))))))

(defn acquire-singular-unique-key
  "attempt to acquire a singular unique key, returning a
   Deferred[Right[[:ok key info]]] or a Deferred[Right[[:fail key reason]]]"

   returns a Deferred[Either], with Right values describing how
   they were successful, and Left values describing errors"

  [session ^Model model unique-key-table unique-key-record]

  (m/with-monad dm/either-deferred-monad
    (m/mlet [insert-response (re/insert session
                                        (:name unique-key-table)
                                        unique-key-record
                                        {:if-not-exists true})

             inserted? (m/return (applied? insert-response))
