/// <summary>
        /// Prototype method.  This will eventually take list of guids to update
        /// </summary>
        /// <param name="consumerTrustId"></param>
        private void GetSavingsBalance(Guid consumerTrustId)
        {
            string gcsAccountNumber = String.Empty;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                // This provides a context for any transactions.
                DataModelTransaction dataModelTransaction = DataModelTransaction.Current;
                ConsumerTrustRow     consumerTrustRow     = DataModel.ConsumerTrust.ConsumerTrustKey.Find(consumerTrustId);
                consumerTrustRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                try
                {
                    if (consumerTrustRow.IsSavingsAccountNull() == false)
                    {
                        gcsAccountNumber = consumerTrustRow.SavingsAccount;
                    }
                }
                finally
                {
                    consumerTrustRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                }
            }

            //If there is no GCS account number then we have no need to continue processing.
            //HACK  add logging for empty account numbers
            if (String.IsNullOrEmpty(gcsAccountNumber) == false)
            {
                Decimal savingsBalance = GetSavingsBalance(gcsAccountNumber);
                if (savingsBalance != -1.0M)
                {
                    UpdateSavingsBalance(consumerTrustId, savingsBalance);
                }
            }
        }
        /// <summary>
        /// Extract information from the settlementRow to send to GCS
        /// </summary>
        /// <param name="rawSettlementRow"></param>
        private void ProcessSettlement(ConsumerTrustSettlementRow rawSettlementRow)
        {
            List <PaymentInfo> paymentInfoList  = new List <PaymentInfo>();
            String             gcsAccountNumber = String.Empty;

            try
            {
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    // This provides a context for any transactions.
                    DataModelTransaction dataModelTransaction = DataModelTransaction.Current;

                    if (rawSettlementRow != null)
                    {
                        rawSettlementRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                        bool settlementDeletedOrDetached = false;
                        try
                        {
                            settlementDeletedOrDetached = rawSettlementRow.RowState == DataRowState.Deleted ||
                                                          rawSettlementRow.RowState == DataRowState.Detached;
                        }
                        finally
                        {
                            rawSettlementRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                        }

                        //If the settlement was removed by the time we got to this, then there is no need to continue
                        if (settlementDeletedOrDetached == true)
                        {
                            return;
                        }
                    }

                    RowLockingWrapper <ConsumerTrustSettlementRow> settlementRow = new RowLockingWrapper <ConsumerTrustSettlementRow>(rawSettlementRow, dataModelTransaction);
                    settlementRow.AcquireReaderLock();
                    try
                    {
                        //We need GCS account id for this payment.  We cannot find a GCS account number then we cannot process this payment.
                        Guid creditCardId = Guid.Empty;
                        ConsumerTrustNegotiationRow negotiationRow = settlementRow.TypedRow.ConsumerTrustNegotiationRow;
                        negotiationRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                        try
                        {
                            creditCardId = negotiationRow.CreditCardId;
                        }
                        finally
                        {
                            negotiationRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                            //no longer usable
                            negotiationRow = null;
                        }

                        //HACK - add error reporting
                        if (creditCardId == Guid.Empty)
                        {
                            return;
                        }

                        //Determine the consumer
                        Guid          consumerId    = Guid.Empty;
                        CreditCardRow creditcardRow = DataModel.CreditCard.CreditCardKey.Find(creditCardId);
                        creditcardRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                        try
                        {
                            consumerId = creditcardRow.ConsumerId;
                        }
                        finally
                        {
                            creditcardRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                            //no longer usable
                            creditcardRow = null;
                        }

                        //HACK - add error reporting
                        if (consumerId == Guid.Empty)
                        {
                            return;
                        }

                        //Determine the consumerTrust
                        ConsumerTrustRow consumerTrustRow = null;
                        ConsumerRow      consumerRow      = DataModel.Consumer.ConsumerKey.Find(consumerId);
                        consumerRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                        try
                        {
                            consumerTrustRow = consumerRow.GetConsumerTrustRows_NoLockCheck().First();
                        }
                        finally
                        {
                            consumerRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                            //no longer usable
                            consumerRow = null;
                        }

                        //HACK - add error reporting
                        if (consumerTrustRow == null)
                        {
                            return;
                        }

                        consumerTrustRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                        try
                        {
                            gcsAccountNumber = (consumerTrustRow.IsSavingsAccountNull()) ? String.Empty : consumerTrustRow.SavingsAccount;
                        }
                        finally
                        {
                            consumerTrustRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                            //no longer usable
                            consumerTrustRow = null;
                        }

                        //HACK - add error reporting
                        if (String.IsNullOrEmpty(gcsAccountNumber))
                        {
                            return;
                        }


                        foreach (ConsumerTrustPaymentRow paymentRow in settlementRow.TypedRow.GetConsumerTrustPaymentRows())
                        {
                            paymentRow.AcquireReaderLock(dataModelTransaction.TransactionId, DataModel.LockTimeout);
                            try
                            {
                                if (paymentRow.RowState != DataRowState.Deleted &&
                                    paymentRow.RowState != DataRowState.Detached)
                                {
                                    paymentInfoList.Add(new PaymentInfo(paymentRow));
                                }
                            }
                            finally
                            {
                                paymentRow.ReleaseReaderLock(dataModelTransaction.TransactionId);
                            }
                        }
                    }
                    finally
                    {
                        settlementRow.ReleaseReaderLock();
                    }
                }
            }
            catch (Exception ex)
            {
                EventLog.Error(ex);
            }

            if (String.IsNullOrEmpty(gcsAccountNumber) == false && paymentInfoList.Count != 0)
            {
                SendPaymentsToGCS(gcsAccountNumber, paymentInfoList);
            }
        }