for (Map.Entry<Object, Object> entry : value.entrySet()) {
Object obj = entry.getValue();
Class<? extends Object> vClass = obj.getClass();
if ( obj instanceof QueryResultsImpl) {
obj = new FlatQueryResults( (QueryResultsImpl)obj );
} else if (obj instanceof FactHandle ) {
obj = ((InternalFactHandle)obj).toExternalForm();
} else if (List.class.isAssignableFrom(vClass) && !JaxbListWrapper.class.equals(vClass)) {
obj = new JaxbListWrapper( ((List<?>) obj).toArray( new Object[((List<?>) obj).size()]) );;
}