private  PublishTransactionData[] GetPublishTransactions()
 {
     PublishTransactionsFilterData filter = new PublishTransactionsFilterData()
     {
         EndDate = DateTime.Now,
         BaseColumns = ListBaseColumns.Extended,
         StartDate = DateTime.Now.AddHours(-1)
     };
     PublishTransactionData[] publishTransactions = Client.GetSystemWideList(filter).Cast<PublishTransactionData>().ToArray();
     return publishTransactions;
 }
        /// <summary>
        /// Processes the core service record.
        /// </summary>
        /// <remarks>Used for proper error handling of core service fault exception.</remarks>
        protected override void ProcessCoreServiceRecord()
        {
            PublishTransactionsFilterData filter = new PublishTransactionsFilterData()
            {
                EndDate = Before
            };
            IEnumerable <PublishTransactionData> list = CoreServiceClient.GetSystemWideList(filter).Cast <PublishTransactionData>();

            foreach (var publishTransactionData in list)
            {
                if ((!Successful && !Failed) ||
                    (Successful && publishTransactionData.State == PublishTransactionState.Success) ||
                    (Failed && publishTransactionData.State == PublishTransactionState.Failed))
                {
                    CoreServiceClient.Delete(publishTransactionData.Id);
                    WriteObject(publishTransactionData);
                }
            }
        }
 /// <summary>
 /// Processes the core service record.
 /// </summary>
 /// <remarks>Used for proper error handling of core service fault exception. </remarks>
 protected override void ProcessCoreServiceRecord()
 {
     if (!string.IsNullOrEmpty(Id))
     {
         IdentifiableObjectData result = CoreServiceClient.Read(Id, null);
         if (!(result is PublishTransactionData))
         {
             throw new ArgumentException(string.Format("Expected item type: {0}.", ItemType.PublishTransaction), "Id");
         }
         WriteObject(result);
     }
     else
     {
         PublishTransactionsFilterData filter = new PublishTransactionsFilterData
         {
             PublisherHost = PublisherHost,
             IsCompleted   = IsCompleted
         };
         WriteObject(CoreServiceClient.GetSystemWideList(filter), true);
     }
 }