code: public static ODatabaseDocument castToODatabaseDocument(ODatabase<?> db)
  	{
  		while(db!=null && !(db instanceof ODatabaseDocument))
  		{
  			if(db instanceof ODatabaseInternal<?>)
  			{
  				db = ((ODatabaseInternal<?>)db).getUnderlying();
  			}
  		}
  		return (ODatabaseDocument)db;
  	}
docs: Utility method to obtain {@link ODatabaseDocument} from {@link ODatabase}
  @param db {@link ODatabase} to cast from
  @return {@link ODatabaseDocument} for a specified {@link ODatabase}