                                     lookup-record))]
                [t lookup-record]))))))))
 
-(defn upsert-lookups
-  [^Session session ^Entity entity old-record record]
+(s/defn upsert-lookups
+  [session :- Session
+   entity :- Entity
+   old-record :- t/MaybeRecordSchema
+   record :- t/MaybeRecordSchema]
   (combine-responses
    (for [[t r] (lookup-record-seq entity old-record record)]
      (upsert-record session entity t r))))
 
-(defn copy-unique-keys
-  [^Entity entity from to]
+(s/defn copy-unique-keys
+  [entity :- Entity
+   from :- t/MaybeRecordSchema
+   to :- t/MaybeRecordSchema]
   (let [unique-key-tables (:unique-key-tables entity)]
     (reduce (fn [r t]
               (let [key-col (last (:key t))]

               (not= old-key-value new-key-value))
      old-key-value)))

(defn delete-stale-secondaries
  [^Session session ^Entity entity old-record new-record]
  (combine-responses
   (filter
    identity

              (k/extract-key-value k record))
         (upsert-record session entity t record))))))

(s/defn stale-lookup-key-values
  [entity :- Entity
   old-record :- t/MaybeRecordSchema
   new-record :- t/MaybeRecordSchema
   lookup-key-table :- t/LookupTableSchema]
  (let [key (:key lookup-key-table)
        col-colls (:collections lookup-key-table)]

