I extracted this from the `createModule` logic, so that I could re-use it in `deleteModule`.