code: @SuppressWarnings("unchecked")
      @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#mapModuleId, 'de.terrestris.shoguncore.model.module.Map', 'UPDATE')")
      public List<Layer> setLayersForMap(Integer mapModuleId, List<Integer> layerIds) throws Exception {
          E module = this.findById(mapModuleId);
          List<Layer> layers = new ArrayList<Layer>();
  
          if (module instanceof Map) {
              Map mapModule = (Map) module;
              for (Integer id : layerIds) {
                  PersistentObject entity = this.layerService.findById(id);
                  if (entity instanceof Layer) {
                      Layer layer = (Layer) entity;
                      if (layer != null) {
                          layers.add(layer);
                      }
                  }
              }
              mapModule.setMapLayers(layers);
              this.saveOrUpdate((E) mapModule);
              return layers;
          } else {
              throw new Exception("Can't find mapModule with id " + mapModuleId.toString());
          }
  
      }
docs: TODO secure this method!?
  
  @param layerIds
  @throws Exception