   "Measurement map is pipelines through a number of validation
   functions. Returns map of measurement with updated metadata."
   [store m]
-  (dbnew/with-session [session (:hecuba-session store)]
+  (db/with-session [session (:hecuba-session store)]
     (let [sensor (sensor-exists? session m)
           events (-> sensor first :events)
           where  (where-from m)

      (label-invalid-value session sensor (where-from m)))))

(defn- sensor-exists? [session m]
  (first (dbnew/execute session
                  (hayt/select :sensors
                               (hayt/where (where-from m))))))


  [[= :device_id (:device_id m)] [= :type (:type m)]])

(defn- update-sensor [session sensor delta]
  (db/execute session
                 (hayt/update :sensors
                              (hayt/set-columns delta)
                              (hayt/where (where-from sensor)))))
