 
 (defn explode-and-sort-by-schema [item schema]
   (let [exploded-item
-        (->> schema
-             (mapcat
-               (fn [attr]
-                 (let [t (attribute-type attr)]
-                   (case t
-                     :attribute          (do
-                                           (list [(name attr) (item attr)]))
-                     :nested-item        (do
-                                           (explode-nested-item attr (item (:name attr))))
-                     :associated-items   (do
-                                           (explode-associated-items attr (item (:name attr)))))))))]
+         (mapcat
+           (fn [attr]
+             (let [t (attribute-type attr)]
+               (case t
+                 :attribute          (list [(name attr) (item attr)])
+                 :nested-item        (explode-nested-item attr (item (:name attr)))
+                 :associated-items   (explode-associated-items attr (item (:name attr))))))
+           schema)]
     exploded-item))
 
 (defn extract-attribute [attr-key input]

          method       (:request-method request)
          route-params (:route-params request)
          entity_id    (:entity_id route-params)
          entity       (-> (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))) first)]
      (case method
        :post (not (nil? entity))
        :get (let [items (db/execute session (hayt/select :profiles (hayt/where [[= :entity_id entity_id]])))]


(defn resource-exists? [store ctx]
  (db/with-session [session (:hecuba-session store)]
    (let [request    (:request ctx)
          _          (log/infof "resource-exists? request: %s" request)
          entity_id  (-> request :params :entity_id)
          profile_id (-> request :params :profile_id)
