def add_item(self, item, index=True):
        name_property = getattr(self.__class__, "name_property", None)
        generated_hosts = []
        if name_property:
            name = getattr(item, name_property, None)
            if name and '[' in name and ']' in name:
                pattern = name[name.find("[")+1:name.find("]")]
                if '-' in pattern:
                    logger.debug("Found an host with a patterned name: %s", pattern)
                    limits = pattern.split('-')
                    fmt = "%d"
                    min_v = 1
                    max_v = 1
                    if len(limits) == 3:
                        fmt = limits[2]
                        new_name = name.replace('[%s-%s-%s]' % (limits[0], limits[1], fmt), '***')
                    else:
                        new_name = name.replace('[%s-%s]' % (limits[0], limits[1]), '***')
                    try:
                        min_v = int(limits[0])
                    except ValueError:
                        pass
                    try:
                        max_v = int(limits[1])
                    except ValueError:
                        pass
                    for idx in range(min_v, max_v + 1):
                        logger.debug("- cloning host: %s", new_name.replace('***', fmt % idx))
                        new_host = deepcopy(item)
                        new_host.uuid = get_a_new_object_id()
                        new_host.host_name = new_name.replace('***', fmt % idx)
                        for prop in ['display_name', 'alias', 'notes', 'notes_url', 'action_url']:
                            if getattr(new_host, prop, None) is None:
                                continue
                            value = getattr(new_host, prop)
                            if '$HOSTNAME$' in value:
                                setattr(new_host, prop, value.replace('$HOSTNAME$',
                                                                      new_host.host_name))
                        generated_hosts.append(new_host)
        if generated_hosts:
            for new_host in generated_hosts:
                if index is True:
                    new_host = self.index_item(new_host)
                self.items[new_host.uuid] = new_host
            logger.info("    cloned %d hosts from %s", len(generated_hosts), item.get_name())
        else:
            if index is True and name_property:
                item = self.index_item(item)
            self.items[item.uuid] = item
        return generated_hosts