private Object handleMedi(Object tos) {
      if (tos instanceof Source && ((Source)tos).getMediaType() == null) {
         return new FieldRef(tos, "MediaType");
      }
      // move medi tag out from under caln in a repository ref
      else if (tos instanceof FieldRef && ((FieldRef)tos).getTarget() instanceof RepositoryRef &&
               ((FieldRef)tos).getFieldName().equals("CallNumber") &&
               ((RepositoryRef)((FieldRef)tos).getTarget()).getMediaType() == null) {
         ((RepositoryRef)((FieldRef)tos).getTarget()).setMediUnderCalnTag(true);
         return new FieldRef(((FieldRef)tos).getTarget(), "MediaType");
      }
      return null;
   }