public Collection <T> RunPSCommand <T>(PSCommand command) where T : class
        {
            ErrorRecord errorRecord   = null;
            string      commandString = AnchorRunspaceProxy.GetCommandString(command);

            try
            {
                Collection <T> result = this.RunPSCommand <T>(command, out errorRecord);
                if (errorRecord == null)
                {
                    this.Context.Logger.Log(MigrationEventType.Verbose, "Running PS command {0}", new object[]
                    {
                        commandString
                    });
                    return(result);
                }
            }
            catch (ParameterBindingException ex)
            {
                this.HandleException <T>(commandString, ex);
            }
            catch (CmdletInvocationException ex2)
            {
                this.HandleException <T>(commandString, ex2);
            }
            AnchorUtil.AssertOrThrow(errorRecord != null, "expect to have an error at this point", new object[0]);
            if (errorRecord.Exception != null)
            {
                this.HandleException <T>(commandString, errorRecord.Exception);
            }
            throw new MigrationPermanentException(ServerStrings.MigrationRunspaceError(commandString, errorRecord.ToString()));
        }