Most of the time the code calling plugins already has an XWikiDocument object that should be changed.