PSObject de-encapsulation refactoring and generalization