 
 (defn set-desired [m k presence]
   (assert-presence presence)
-  (assoc-in m [::todo k ::desired] presence))
+  (-> m
+      (assoc-in [::todo k ::desired] presence)
+      (update-indexes k)))
 
 (defn set-actual [m k presence]
   (assert-presence presence)
-  (assoc-in m [::todo k ::actual] presence))
+  (-> m
+      (assoc-in [::todo k ::actual] presence)
+      (update-indexes k)))
 
 (defn get [m k]
   (let [{::keys [state desired actual]

(defn merge-state [m k new-state]
  (update-in m [::todo k ::state] merge new-state))

(defn- assert-presence [presence]
  (assert (or (= :present presence)
              (= :absent presence))

               :ignore)}))

(defn creatable [m]
  (->> (::creatable m)
       (map #(get-in m [::todo % ::state]))))

(defn deletable [m]
  (->> (::deletable m)
       (map #(get-in m [::todo % ::state]))))
