Make more use of DefineConsoleMethod

Resubmission of #887 with some fixes.
I think this is wrong ```argv[ 0 ]``` are namespace name, better use ```"PersistenceManager::setDirty"```