           new-record
           (:unique-key-tables model)))
 
-(defn acquire-unique-keys
+(defn update-unique-keys
   "attempts to acquire unique keys for an owner... returns
    a Deferred[Right[[:ok updated-owner-record :failed-keys]]] with an updated
    owner record containing only the keys that could be acquired"


(defn update-with-acquire-responses
  [table acquire-key-responses record]
  (reduce (fn [[status key-desc _]]
            (let [coll (:collection table)
                  key-col (last (:key key-desc))
                  key-val (last (:key-value key-desc))]
              (condp = coll
                :set (when-not (= :ok status)
                       (assoc record
                              key-col
                              (disj (get record key-col)
                                    key-val)))
                :list (when-not (= :ok status)
                        (assoc record
                               key-col
                               (filterv #(not= key-val %)
                                        (get record key-col))))

                :map (when-not (= :ok status)
                       (assoc record
                              key-col
                              (dissoc (get record key-col)
                                      key-val)))

                :else (when-not (= :ok status)
                        (assoc record key-col nil)))))
          record
          acquire-key-responses))


                                    new-record)]
            (m/return
             (update-record-by-key-responses
              model
              old-record
              new-record
              acquire-key-responses)))))
