code: public static void updateModelGroupResources(
          HttpServletRequest request,
          HttpServletResponse response,
          String basePath,
          String baseContainerName)
      throws IOException {
  
          if (CmsFlexController.isCmsRequest(request)) {
  
              try {
                  CmsFlexController controller = CmsFlexController.getController(request);
                  CmsObject cms = controller.getCmsObject();
                  CmsResource base = cms.readResource(basePath);
                  List<CmsResource> resources;
                  I_CmsResourceType groupType = OpenCms.getResourceManager().getResourceType(
                      CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
                  if (base.isFolder()) {
                      resources = cms.readResources(
                          basePath,
                          CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(groupType));
                  } else if (OpenCms.getResourceManager().getResourceType(base).equals(groupType)) {
                      resources = Collections.singletonList(base);
                  } else {
                      resources = Collections.emptyList();
                  }
  
                  if (resources.isEmpty()) {
                      response.getWriter().println("No model group resources found at " + basePath + "<br />");
                  } else {
                      for (CmsResource group : resources) {
                          boolean updated = updateModelGroupResource(cms, group, baseContainerName);
                          response.getWriter().println(
                              "Group '" + group.getRootPath() + "' was updated " + updated + "<br />");
                      }
                  }
              } catch (CmsException e) {
                  LOG.error(e.getLocalizedMessage(), e);
                  e.printStackTrace(response.getWriter());
              }
          }
      }
docs: Updates model group resources to the changed data structure.<p>
  This step is necessary when updating from version 10.0.x to 10.5.x.<p>
  
  @param request the request
  @param response the response
  @param basePath the path to the model group, or the base path to search for model groups
  @param baseContainerName the new base container name
  
  @throws IOException in case writing to the response fails