 
 (defn persist-catalog!
   "Persist the supplied catalog in the database"
-  [catalog]
-  (let [{:keys [certname api-version version resources classes edges tags]} catalog]
+  [{:keys [certname api-version version resources classes edges tags] :as catalog}]
+  {:pre [(every? string? #{certname})
+         (number? api-version)
+         (every? coll? #{classes tags edges})
+         (map? resources)]}
 
-    (sql/transaction
-     (persist-certname! certname api-version version)
-     (persist-classes! certname classes)
-     (persist-tags! certname tags)
-     (doseq [resource (vals resources)]
-       (persist-resource! certname resource))
-     (persist-edges! certname edges resources))))
+  (sql/transaction
+   (persist-certname! certname api-version version)
+   (persist-classes! certname classes)
+   (persist-tags! certname tags)
+   (doseq [resource (vals resources)]
+     (persist-resource! certname resource))
+   (persist-edges! certname edges resources)))

(defn persist-resource!
  "Given a certname and a single resource, persist that resource and its parameters"
  [certname {:keys [type title exported parameters tags] :as resource}]

  (let [hash       (compute-hash resource)
        persisted? (resource-already-persisted? hash)

(defn resource-already-persisted?
  "Returns a boolean indicating whether or not the given resource exists in the db"
  [hash]
  {:pre [hash]}
  (sql/with-query-results result-set
    ["SELECT EXISTS(SELECT 1 FROM resources WHERE hash=?) as present" hash]
    (let [row (first result-set)]
