                              :csrf       nil
                              :statement  ""
                              :selection  nil
+                             :selected-reference nil
                              :logged-in? false}
                 :clipboard  {:selections nil
                              :current    nil}

  ([id col]
   (first (filter #(= (str->int id) (:uid %)) col)))
  ([id]
    (get-reference id (get-references))))

;;;; State changing
(defn update-state-item!
  "Get the cursor for given key and select a field to apply the function to it."
  [col key f]
  (om/transact! (get-cursor col) key f))

(defn update-state-map!
  "Get the cursor for given key and update it with the new collection of data."
  [key col]
  (let [state (get-cursor key)]
    (om/transact! state (fn [] col))))


;;;; CSRF Token

  (get-in @app-state [:user :logged-in?]))


;;;; State changing
(defn update-state-item!
  "Get the cursor for given key and select a field to apply the function to it."
  [col key f]
  (om/transact! (get-cursor col) key f))

(defn update-state-map!
  "Get the cursor for given key and update it with the new collection of data."
  [key col]
  (let [state (get-cursor key)]
    (om/transact! state (fn [] col))))


;;;; References
(defn get-references
  "Returns a list of references which were received from the discussion system."
