'Set domain id and mapping for a list of refs.
The method modifies refs in-place.'

def _set_domain_id_and_mapping_for_list(self, ref_list, domain_id, driver, entity_type, conf):

    if (not ref_list):
        return []
    for r in ref_list:
        self._insert_domain_id_if_needed(r, driver, domain_id, conf)
    if (not self._is_mapping_needed(driver)):
        return ref_list
    refs_map = {}
    for r in ref_list:
        refs_map[(r['id'], entity_type, r['domain_id'])] = r
    if (not domain_id):
        domain_id = ref_list[0]['domain_id']
    domain_mappings = self.id_mapping_api.get_domain_mapping_list(domain_id)
    for _mapping in domain_mappings:
        idx = (_mapping.local_id, _mapping.entity_type, _mapping.domain_id)
        try:
            ref = refs_map.pop(idx)
            ref['id'] = _mapping.public_id
        except KeyError:
            pass
    for ref in refs_map.values():
        local_entity = {'domain_id': ref['domain_id'], 'local_id': ref['id'], 'entity_type': entity_type}
        self._insert_new_public_id(local_entity, ref, driver)
    return ref_list
