def update_worldset(world_set, pkg, remove=False):
    """record/kill given atom in worldset"""
    if world_set is None:
        return
    if remove:
        try:
            world_set.remove(pkg)
        except KeyError:
            return
    else:
        world_set.add(pkg)
    world_set.flush()
