code: private void resetSetCounter()
      {
          if (getPage().getDefaultModelObject() instanceof UIForm) {
              for (final Element element : ((UIForm) getPage().getDefaultModelObject()).getElements()) {
                  if (element.getType().equals(ElementType.FORM)) {
                      final Iterator<FormRow> iter = ((UIForm.FormElement) element.getElement()).getRowModels();
                      while (iter.hasNext()) {
                          final FormRow row = iter.next();
                          for (final IUIElement uiElement : row.getValues()) {
                              if (uiElement instanceof UIFieldSet) {
                                  ((UIFieldSet) uiElement).resetIndex();
                              }
                          }
                      }
                  } else if (element.getType().equals(ElementType.SUBFORM)) {
                      for (final Element nElement : ((UIFieldForm) element.getElement()).getElements()) {
                          if (nElement.getType().equals(ElementType.FORM)) {
                              final Iterator<FormRow> iter = ((UIForm.FormElement) nElement.getElement()).getRowModels();
                              while (iter.hasNext()) {
                                  final FormRow row = iter.next();
                                  for (final IUIElement uiElement : row.getValues()) {
                                      if (uiElement instanceof UIFieldSet) {
                                          ((UIFieldSet) uiElement).resetIndex();
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
docs: Reset the counters for sets.