@classmethod
def _replace_same_name_entities(cls, tree):
    """
        Changes same section names in the doc by adding <-{index}>
        to the next section occurrences.

        :param tree: ElementTree of the doc
        :return: ElementTree
        """
    sec_map = {}
    prop_map = {}
    root = tree.getroot()
    for sec in root.iter('section'):
        sec_name = sec.find('name')
        if sec_name is not None:
            cls._change_entity_name(tree, sec_map, sec_name)
        else:
            raise Exception('Section attribute name is not specified')
        for prop in sec.iter('property'):
            if prop.getparent() == sec:
                prop_name = prop.find('name')
                if prop_name is not None:
                    cls._change_entity_name(tree, prop_map, prop_name)
        prop_map.clear()
    return tree
