 (def item-resource-config {
   :available-charsets [common/UTF8]
   :handle-not-found (fn [ctx] (when (:bad-collection ctx) common/missing-collection-response))
-  :handle-unprocessable-entity (fn [ctx] (common/unprocessable-entity-response (unprocessable-reason (:reason ctx))))
+  :handle-unprocessable-entity (fn [ctx] (unprocessable-reason (:reason ctx)))
 })
 
 (defresource item [coll-slug item-slug]

(defn- item-location-response [coll-slug item]
  (common/location-response [coll-slug (:slug item)] (render-item item) item/item-media-type))

;; ----- Create new item -----

(defn- create-item [coll-slug item]
  (when-let [item (item/create-item coll-slug (:name item) item)]
    {:item item}))

(defn- unprocessable-reason [reason]
  (match reason
    :bad-collection common/missing-collection-response
    :bad-item missing-item-response
    :no-name "Name is required."
    :property-conflict "A reserved property was used."
    :slug-conflict "Slug already used in collection."
    :invalid-slug "Invalid slug."
    :else "Not processable."))

;; ----- Update item -----


    :post (fn [_] (common/only-accept 406 item/item-media-type))})
  :allowed-methods [:get :post]
  :exists? (fn [_] (get-items coll-slug))

  ;; Get a list of items
  :handle-ok (fn [ctx] (render-items coll-slug (:items ctx)))

  ;; Create new item
  :malformed? (by-method {
    :get false
