check if record exists before trying to add/remove it