code: protected Map<String, List<Element>> elementsIndexByName() {
          HashMap<String, List<Element>> index = new HashMap<>();
          for (Object part : renderingParts) {//We have to use the rendering order of elements for multiple elements with same name
              if (part instanceof Element) {
                  Element element = (Element) part;
                  String name = element.getProperty("name");
                  if (name != null && !name.trim().isEmpty()) {
                      boolean multiValued = element.isMultiValue();
                      if (multiValued && index.containsKey(name)) {
                          throw new IllegalStateException("Name '" + name + "' cannot be repeated in the form if any of the elements is multi-valued");
                      }
  
                      if (name.contains("[") && name.contains("]")) {
                          throw new IllegalStateException("Name '" + name + "' cannot be in array form");
                      }
  
                      if (!index.containsKey(name)) {
                          index.put(name, new ArrayList<Element>());
                      } else {
                          Class<?> expectedType = index.get(name).get(0).getValueType();
                          if (!element.getValueType().equals(expectedType)) {
                              //This is necessary for calling fillBeanProperties
                              throw new IllegalStateException("Multiple elements with same name '" + name + "' should all have the same value type");
                          }
                      }
  
                      index.get(name).add(element);
                  }
              }
  
          }
  
          return index;
      }
docs: Creates an index of the form element by their name. Makes sure that the names are not repeated and are valid.
  
  @return Index of elements by name