 (defn update-with [user blog]
   (let [new-blog (assoc blog :user user)
         id (:id new-blog)
-        db-object (find-blog-object id)]
+        db-object (find-blog-object-by-sid id)]
     (if (and (not= nil db-object) (own? user db-object))
       (-> new-blog
           (generate-title)

      (error "Db object deleted or not own. Refusing to update:" user new-blog id))))

(defn find-by [user sid]
  (info sid)
  (let [obj (find-blog-object-by-sid sid)]
    (if (or (not (:draft obj)) (= (:user obj) user))
      (from-db-to-user obj)
      (error "Cannot view draft from another user:" user sid))))

(defn delete-by [user id]
  (let [db-object (find-blog-object id)
        oid (:_id db-object)]
    (if (and (not= nil db-object) (own? user db-object))
      {:id id

  {:drop []
   :transform {:distance to-human-distance
               :time to-human-time}
   :validation [identity :sid]})

(defn from-db-to-user [obj]
  (-> obj (transform-fields-using from-db-to-user-transform) _id-to-id))
