i would do it in 2 steps. find the parent, and only if it is not null, set it on the object. just to be extra save, in case the user is doing something funny.