public bool RecalculateTransaction(Dictionary <int, Int64> nominalTransaction, Person loggingPerson)
        {
            bool changedTransaction = false;

            // We need to create a delta. This is... somewhat complicated.

            // 1) Iterate over the rows to build a "current" transaction record.
            // 2) Create a "should-look-like" transaction record. (done in calling routine, already).
            // 3) Apply the delta, in two steps.

            Dictionary <int, Int64> currentTransaction = GetRecalculationBase();

            FinancialTransaction continuedTransaction = ContinuedTransaction;

            if (continuedTransaction != null)
            {
                continuedTransaction.AddContinuedTransactionsToLookup(currentTransaction);
                // Recurses to all continued transactions
            }

            // Step 2: create an image of what the transaction SHOULD look like with changes.
            //         now done in calling routine.

            // Step 3a: For all accounts existing in Current but not in Nominal, set them to 0, and
            // vice versa.

            foreach (int accountId in currentTransaction.Keys)
            {
                if (!nominalTransaction.ContainsKey(accountId))
                {
                    nominalTransaction[accountId] = 0;
                }
            }

            foreach (int accountId in nominalTransaction.Keys)
            {
                if (!currentTransaction.ContainsKey(accountId))
                {
                    currentTransaction[accountId] = 0;
                }
            }

            // Step 3b: Iterate over all accounts in the two sets -- which now has the same keys --
            // and apply the delta to the transaction.

            foreach (int accountId in currentTransaction.Keys)
            {
                if (currentTransaction[accountId] != nominalTransaction[accountId])
                {
                    AddRow(accountId, nominalTransaction[accountId] - currentTransaction[accountId],
                           loggingPerson == null ? 0 : loggingPerson.Identity);
                    changedTransaction = true;
                }
            }

            return(changedTransaction);
        }
        private void AddContinuedTransactionsToLookup(Dictionary <int, Int64> currentTransactionData)
        {
            FinancialTransaction continuedTransaction = ContinuedTransaction;

            if (continuedTransaction != null)
            {
                continuedTransaction.AddContinuedTransactionsToLookup(currentTransactionData);
            }

            foreach (FinancialTransactionRow row in Rows)
            {
                if (!currentTransactionData.ContainsKey(row.FinancialAccountId))
                {
                    currentTransactionData[row.FinancialAccountId] = 0;
                }

                currentTransactionData[row.FinancialAccountId] += row.AmountCents;
            }
        }