         (doseq [filename filenames]
           (let [data (read-string (slurp filename))]
             (if (and (map? data) (:company data) (:sections data))
-              (import-company options data)
+              (import-company conn options data)
               (exit 1 (data-msg))))))
       (catch Exception e
         (println e)

        message (str "'" section-name "' at " timestamp " by " (:name author) ".")]
    (println (str "Creating " message))
    (if
      (section/put-section company-slug section-name (:section section) (assoc author :org-id org-id) timestamp)
      (println (str "SUCCESS: created " message))
      (println (str "FAILURE: creating " message))))
  (recur company-slug (rest sections) org-id)))

(defn- import-sections-map
  "Update the company with the specified slug with the specified :sections map."
  [slug sections]
  (println (str "Updating company sections for '" slug "'."))
  (if-let [original-company (common/read-resource company/table-name slug)]
    (common/update-resource company/table-name :slug original-company (assoc original-company :sections sections))))

;; ----- Company import -----

(defn import-company [options data]
  (let [company (:company data)
        slug (:slug company)
        delete (:delete options)
        author (:author company)
        org-id (:org-id company)]
    (when (and delete (company/get-company slug))
      (println (str "Deleting company '" slug "'."))
      (company/delete-company slug))
    (when-not delete
      (when (company/get-company slug)
        (exit 1 (str "A company for '" slug "' already exists. Use the -d flag to delete the company on import."))))
    (println (str "Creating company '" slug "' by " (:name author)"."))
    (company/create-company!
     (company/->company
      (dissoc company :author :timestamp :sections :org-id)
      (assoc author :org-id org-id)))
    (import-sections slug (:sections data) org-id)
    (import-sections-map slug (:sections company)))
  (println "\nImport complete!\n"))

;; ----- CLI -----


(defun- import-sections
  "Add each section to the company recursively."
  ([conn _company-slug _sections :guard empty? _org-id] true)

  ([conn company-slug sections org-id]
  (let [section (first sections)
        section-name (:section-name section)
        timestamp (:timestamp section)
