                            "]. Provided type was `"
                            task-type
                            "`"))))
+  (when (and (is-project parent)
+             (not= (:id parent)
+                   (:id project)))
+    ;; Ensure that parent is not another project if parent is a project
+    (throw (js/Error. (str "`parent` and `project` can't be different if parent is a project"))))
+  (when (and (is-task parent)
+             (not= (get-in parent [:project :id])
+                   (:id project)))
+    ;; Ensure that parent is in the same project if parent is a task
+    (throw (js/Error. (str "`parent` has to be a task of `project` if parent is a task"))))
   {:name        task-name
    :id          (build-id task-name)
+   :project     (select-keys project [:name :id])
    :parent      (:id parent)
    :type        (if (= (:type parent) "Project")
                   "Task"

  @tasks)

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

;;     - show-before: int >= 0 number of days before the due date when the instance should appear in the inbox

(defn- new-task
  [task-name project parent task-type tags tasks description remind-date due-date show-before repeating done]
  (when-not (is-task {:type task-type})
    (throw (js/Error. (str "Task type must belong to ["
                           (clojure.string/join ", "
