private Object handlePrim(Object tos) {
      if ((tos instanceof Media && ((Media)tos).getPrimary() == null) ||
          (tos instanceof ParentFamilyRef && ((ParentFamilyRef)tos).getPrimary() == null)) {
         return new FieldRef(tos, "Primary");
      }
      return null;
   }