       (do (swap! state dissoc id)
           true)
       false)))
-
-(defmacro def-delete-handler [name Model]
-  `(s/defn ~name :- s/Bool
-     [state# :- (s/atom {s/Str ~Model})
-      id# :- s/Str]
-     (if (contains? (deref state#) id#)
-       (do (swap! state# dissoc id#)
-           true)
-       false)))
 
 (defn list-handler [Model]
   (s/fn :- (s/maybe Model)

    (get (swap! state assoc id updated-model) id)))


(defmacro def-create-handler [name Model NewModel swap-fn id-fn]
  `(s/defn ~name :- ~Model
     [state# :- (s/atom {s/Str ~Model})
      login# :- s/Str
      new-model# :- ~NewModel]
     (let [new-id# (~id-fn new-model#)]
       (get
        (swap! state# ~swap-fn new-model# new-id# login#)
        new-id#))))

(defmacro def-update-handler [name Model NewModel swap-fn]
  `(s/defn ~name :- ~Model
     [state# :- (s/atom {s/Str ~Model})
      id# :- c/ID
      login# :- s/Str
      updated-model# :- ~NewModel]
     (get
      (swap! state#
             ~swap-fn
             updated-model#
             id#
             login#
             (get (deref state#) id#))
      id#)))

(defn delete-handler [Model]
  (s/fn :- s/Bool
    [state :- (s/atom {s/Str Model})

    [state :- (s/atom {s/Str Model})
     id :- s/Str]
    (get (deref state) id)))

(defn create-handler-from-realized
  "Create a new resource from a realized object"
