                                   "entity")
       validated)))
 
+(defn- validate-new-entity
+  [storage entity]
+  (validate-entity storage NewEntity entity))
+
+(defn- validate-existing-entity
+  [storage entity]
+  (validate-entity storage Entity entity))
+
 (defn create
   "Creates a new entity"
   [storage-spec entity]
   (let [s (storage storage-spec)]
     (->> entity
-         (validate-entity s)
+         (validate-new-entity s)
          prepare-entity-for-save
          (create-entity s)
          prepare-entity-for-return)))


(def Entity
  "Schema for saved entities"
  (merge NewEntity {:id s/Int}))

(defn- prepare-entity-for-save
  [entity]

  [storage-spec entity]
  (-> storage-spec
      storage
      (validate-existing-entity entity)
      (update-entity entity)))
