private Object handleNote(Object tos, String id, String ref) {
      if (tos instanceof NoteContainer) {
         if (ref == null) {
            Note note = new Note();
            ((NoteContainer)tos).addNote(note);
            return note;
         }
         else {
            NoteRef noteRef = new NoteRef();
            noteRef.setRef(ref);
            ((NoteContainer)tos).addNoteRef(noteRef);
            return noteRef;
         }
      }
      else if (tos instanceof Gedcom) {
         Note note = new Note();
         if (id != null) {
            note.setId(id);
         }
         if (ref != null) {
            // ref is invalid here, so store it as value - another geni-ism
            note.setValue("@"+ref+"@");
         }
         ((Gedcom)tos).addNote(note);
         return note;
      }
      return null;
   }