                            :pushed_at]))
 
 (defn make-repositories
-  []
-  (let [repos (ref {:repositories (sorted-map)})]
-    (->RepositoryList repos)))
+  [organizations]
+  (let [repos (repeatedly (count organizations) sorted-map)
+        state (ref (zipmap organizations repos))]
+    (->RepositoryList state)))

(ns otto.repositories)

(defn- repository-key
  [organization repository-data]
  (let [o (:name organization)
        n (:name repository-data)]
    [o n]))

(defprotocol ARepositoryList
  (items  [this organization])

  [a]
  ARepositoryList
  (items [this organization]
    (get @a organization))
  (update [this organization repository]
    (let [k (:name repository)
          t (System/currentTimeMillis)
          v (assoc repository :_timestamp t)]
      (dosync (alter a assoc-in [organization k] v)))))

(defn make-repository
  [attributes]
