code: private synchronized void populateFromDbHelper(Map<Long, ResourceGroupSpecBuilder> recordMap,
              Set<Long> rootGroupIds,
              Map<Long, ResourceGroupIdTemplate> resourceGroupIdTemplateMap,
              Map<Long, Set<Long>> subGroupIdsToBuild)
      {
          List<ResourceGroupSpecBuilder> records = dao.getResourceGroups(environment);
          for (ResourceGroupSpecBuilder record : records) {
              recordMap.put(record.getId(), record);
              if (!record.getParentId().isPresent()) {
                  rootGroupIds.add(record.getId());
                  resourceGroupIdTemplateMap.put(record.getId(), new ResourceGroupIdTemplate(record.getNameTemplate().toString()));
              }
              else {
                  subGroupIdsToBuild.computeIfAbsent(record.getParentId().get(), k -> new HashSet<>()).add(record.getId());
              }
          }
      }
docs: Populate temporary data structures to build resource group specs and selectors from db