@classmethod
def restore_ids(cls, obj, ids):
    """
        Given an list of ids as captured with capture_ids, restore the
        ids. Note the structure of an object must not change between
        the calls to capture_ids and restore_ids.
        """
    ids = iter(ids)
    obj.traverse(lambda o: setattr(o, 'id', next(ids)))
