def METHOD_NAME(domain, app_id, pre_to_post_map):
    overrides_by_pre_id = get_xform_resource_overrides(domain, app_id)
    errors = []
    new_overrides = []
    for pre_id, post_id in pre_to_post_map.items():
        if pre_id in overrides_by_pre_id:
            if post_id != overrides_by_pre_id[pre_id].post_id:
                errors.append("Attempt to change {} from {} to {}".format(
                    pre_id,
                    overrides_by_pre_id[pre_id].post_id,
                    post_id
                ))
        else:
            new_overrides.append(ResourceOverride(
                domain=domain,
                app_id=app_id,
                root_name=XFormResource.ROOT_NAME,
                pre_id=pre_id,
                post_id=post_id,
            ))
    if new_overrides and not errors:
        ResourceOverride.objects.bulk_create(new_overrides)
        get_xform_resource_overrides.clear(domain, app_id)
    if errors:
        raise ResourceOverrideError("""
            Cannot update overrides for domain {}, app {}, errors:\n{}
        """.strip().format(domain, app_id, "\n".join(["\t{}".format(e) for e in errors])))
    return new_overrides