 
 (defn handle-command [command events injections]
   (let [command (commands/validate-command command)
-        congregation (reduce write-model2 nil events)
+        congregation (reduce write-model nil events)
         injections (merge {:check-permit (fn [permit]
                                            (permissions/check (:state injections)
                                                               (:command/user command)

(defmethod command-handler :congregation.command/add-user
  [command congregation {:keys [user-exists? check-permit]}]
  (let [cong-id (:congregation/id congregation)
        user-id (:user/id command)]
    (check-permit [:configure-congregation cong-id])
    (when-not (user-exists? user-id)
      (throw (ValidationException. [[:no-such-user user-id]])))
    (when-not (contains? (::users congregation) user-id)
      [{:event/type :congregation.event/permission-granted
        :event/version 1
        :congregation/id cong-id


;;;; Write model

(defn- write-model [congregation event]
  (-> congregation
      (update-congregation event)))

(defmulti ^:private command-handler (fn [command _congregation _injections]
