                          (let [body-map (reduce conj {} decoded-body)]
                            (parse-by-schema body-map profile-schema))
                          decoded-body)
-              entity_id  (-> item :entity_id)
+              {:keys [entity_id profile_id]} item
               username   (sec/session-username (-> ctx :request :session))
               user_id    (-> (db/execute session (hayt/select :users (hayt/where [[= :username username]]))) first :id)
-              profile_id (-> item :profile_id)]
+              ]
           (db/execute session (hayt/insert :profiles (hayt/values (-> body
                                                                       (assoc :id profile_id)
                                                                       (assoc :user_id user_id)

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

          user_id    (-> (db/execute session (hayt/select :users (hayt/where [[= :username username]]))) first :id)
          profile_id (sha1/gen-key :profile profile)]
      (when (and entity_id timestamp)
        (when (seq
                (first
                  (db/execute session (hayt/select :entities (hayt/where [[= :id entity_id]])))))
          (let [query-profile (-> profile
                                 (assoc :user_id user_id)
                                 (update-stringified-lists
