   "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)

(defn- reset-counters!
  "Resets the counters for a given sensor."
  [session where]
  (dbnew/execute session
   (hayt/update :sensors
                (hayt/set-columns {:events 0
                                   :errors 0})

  [[= :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)))))
