   (if (and (:repeating task)
            (= (get-in task [:repeating :type])
               "pattern"))
-    (swap! repeating-tasks assoc (:id task) task)
+    (register-entity-in task repeating-tasks)
     (if (:done task)
-      (swap! completed-tasks assoc (:id task) task)
-      (swap! active-tasks assoc (:id task) task)))
+      (register-entity-in task completed-tasks)
+      (register-entity-in task active-tasks)))
+  (register-entity-in task tasks)
   (register-tags! task :tasks))
 
 (defn- store-project!
   [project]
   (if (= (:id project) "Inbox")
     (reset! inbox-project project)
-    (if (:done project)
-      (swap! completed-projects assoc (:id project) project)
-      (swap! active-projects assoc (:id project) project))
+    (do
+      (register-entity-in project projects)
+      (if (:done project)
+        (register-entity-in project completed-projects)
+        (register-entity-in project active-projects)))
     (register-tags! project :projects)))
+
+(defn- get-parent
+  [task]
+  (if (= (:type task) "Task")
+    (get (all-projects) (:parent task))
+    (get (all-tasks) (:parent task))))
 
 (defn- install-task
   [task]

  []
  (str (.now js/Date)))

(defn- is-project
  [entity]
  (= (:type entity) "Project"))

(defn all-projects
  []
  (assoc
    @projects
    "Inbox"
    (inbox)))

(defn all-tasks
  []
  @tasks)

(defn register-task
  [task-name {:keys [parent tags sub-tasks description remind-date due-date show-before repeating]
