      (loop [[x & more] xs ctx ctx]
        (when x
          (recur more (cond
-                      (vector? x) (do (println "vector")
-                                      (insert-vector x session ctx ))
-                      (seq? x) (do (println "seq:" (::prior ctx))
-                                   (doseq [y x]
-                                     (insert (merge (::prior ctx)
-                                                    y)
-                                             session
-                                             ctx)))
-                      (map? x) (do (println "map")
-                                   (insert x session (assoc ctx ::prior x)))
-                      :else (throw (ex-info (str "Invalid value " x) {}))
-                      ))))))
+                      (vector? x) (insert-vector x session ctx )
+                      (seq? x) (doseq [y x]
+                                 (insert (merge (::prior ctx) y)
+                                         session
+                                         ctx))
+                      (map? x) (insert x session (assoc ctx ::prior x))
+                      :else (throw (ex-info (str "Invalid value " x) {}))))))))
 
 (defn load-fixture [session fixture]
   (let [data (compile-element fixture)]
-    (clojure.pprint/pprint data)
     (insert-vector data session)))

(defmethod compile-element clojure.lang.ISeq [xs]
  (for [x xs] (compile-element x)))

(defn- insert* [session table values]
  (dbnew/execute session
     (hayt/insert table (hayt/values values))))

(defn- insert-simple [x session]
    (let [id (str (generators/uuid))
        data (-> x
                 (assoc :id id)
                 (dissoc x ::table))]
      (insert* session (::table x) data)
      id))

(defmulti insert (fn [x _ _] (::table x)) :default :error-no-table)

(defmethod insert :error-no-table [x _ _ ]
  (throw (ex-info "ERROR - NO TABLE:" x)))

(defmethod insert :programmes [x session ctx]
  (assoc ctx :programme_id
         (insert-simple x session)))

(defmethod insert :projects [x session ctx]
  (assoc ctx :project_id
         (insert-simple x session)))

(defmethod insert :entities [x session ctx]
  (assoc ctx :entity_id
         (insert-simple x session)))

(defmethod insert :properties [x session ctx]
  (assoc ctx :property_id
         (insert-simple x session)))

(defmethod insert :devices [x session ctx]
  (let [m {:id (str (generators/uuid))

                   (dissoc :device-id)
                   (update-in [:meteringPointId] str)
                   (update-in [:parent-id] str)
                   (update-in [:location] pr-str))]

    (insert* session (merge x device m))
    (assoc ctx :device_id (:id m))))

(defmethod insert :sensors [x session ctx]
  (let [m {:device_id (:device_id ctx)
           :type (:type x)}
        start (::start x) ;; TODO clojure 1.6-ify
        end   (::end x)]
    (insert* session
             (->> (dissoc x ::start ::end)
                  (merge
                   (generators/generate-sensor-sample (:id x))
                   m)))
    (insert* session
             (->> m
                  (merge
                   {::table :sensor_metadata
                    :lower_ts start
                    :upper_ts end}
                   m)))
    (merge ctx m)))
