   (assert (every? string? added-tags))
   (assert (every? string? removed-tags))
   (assert (every? #{:title} (keys props)))
-  
+
   (db/with-transaction [conn db]
     (if-let [document (get-document conn id)]
       (let [added-tags (set added-tags)

(def ^:private sequenced-tables
  [:pages :page_images :files :documents :document_tags :document_pages])

(let [names (map name sequenced-tables)
      where (s/join ", " (map #(str % "_state_seq as " %) names))
      select (s/join ", " (map #(str % ".current as " %) names))
      query (str "SELECT " select " FROM " where)]
  (defn sequence-numbers [db]
    (-> db
        (db/query [query] :identifiers (comp keyword #(s/replace % "_" "-")))  
        (first))))

(defn document-pages
  "Returns a list of pages for the document with ID."
  [db id]
  (db/query db ["SELECT p.file, p.number, p.rotation
                 FROM pages AS p
                 JOIN document_pages AS dp on dp.page = p.id
                 WHERE dp.document = ?
                 ORDER BY dp.number" id]))
