private Object handleRepo(Object tos, String id, String ref) {
      if (tos instanceof Source && ((Source)tos).getRepositoryRef() == null) {
         RepositoryRef repositoryRef = new RepositoryRef();
         if (ref != null) {
            repositoryRef.setRef(ref);
         }
         ((Source)tos).setRepositoryRef(repositoryRef);
         return repositoryRef;
      }
      else if (tos instanceof Gedcom) {
         Repository repository = new Repository();
         if (id != null) {
            repository.setId(id);
         }
         ((Gedcom)tos).addRepository(repository);
         return repository;
      }
      return null;
   }