check that the associated record exists before saving