   :authorized? (authorized? querier :profile)
   :exists? (partial index-exists? querier)
   :malformed? index-malformed?
-  :post! (partial index-post! querier commander)
+  :post! (partial index-post! commander querier)
   :handle-ok (partial index-handle-ok)
   :handle-created (partial index-handle-created handlers))
 

                                            :status "OK"
                                            :version "4"})}))
      (ring-response {:status 422
                      :body "Provide valid projectId and propertyCode."}))))

(defn resource-exists? [querier ctx]
  (let [{{{:keys [entity-id profile-id]} :route-params} :request} ctx

                ))
      false)))

(defn index-post! [commander querier ctx]
  (let [request       (-> ctx :request)
        profile       (-> ctx :body)
        entity-id     (-> profile :entity-id)
        timestamp     (-> profile :timestamp)
        [username _]  (sec/get-username-password request querier)
        user-id       (-> (hecuba/items querier :user [[= :username username]]) first :id)
        ]
    (when (and entity-id timestamp)
      (when-not (empty? (hecuba/item querier :entity entity-id))
        {:profile-id (hecuba/upsert!
                        commander
                        :profile (-> profile
                                     (assoc :user-id user-id)
                                     (update-stringified-lists
                                       [:airflow-measurements :chps
                                        :conservatories :door-sets
                                        :extensions :floors :heat-pumps
                                        :heating-systems :hot-water-systems
                                        :low-energy-lights :photovoltaics
                                        :roof-rooms :roofs :small-hydros
                                        :solar-thermals :storeys :thermal-images
                                        :walls :wind-turbines :window-sets])
                                     (update-in [:profile-data] json/encode)
                                     ))}))))

(defn index-handle-ok [ctx]
  (let [{items ::items
