           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)]
+          entity       (first (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]]))))]
       (case method
         :post (not (nil? entity))
         :get (let [items (db/execute session (hayt/select :profiles (hayt/where [[= :entity_id entity_id]])))]

  standaed       | timestamp                   | timestamp                  |
  nested item    | profile_data, bedroom_count | profile_data_bedroom_count |
  association    | storeys, first storey_type  | storeys_0_storey_type      |"
  (->> schema
       (reduce
         (fn [item attr]
           (let [t (attribute-type attr)
                 imploded-attribute (case t
                   :attribute               (extract-attribute attr input)
                   :nested-item             (extract-nested-item attr input)
                   :associated-items        (extract-associated-items attr input))]
             (conj item imploded-attribute)))
         {})))

(defn index-malformed? [ctx]
  (let [request (:request ctx)


(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)
