private FinancialAccountProduct CreateFinancialAccountProduct(FinancialAccount financialAccount, FinancialProduct financialProduct, DateTime today)
        {
            FinancialAccountProduct financialAccountProductNew1 = new FinancialAccountProduct();
            financialAccountProductNew1.FinancialAccount = financialAccount;
            financialAccountProductNew1.FinancialProduct = financialProduct;
            financialAccountProductNew1.EffectiveDate = today;

            return financialAccountProductNew1;
        }
        public OutstandingLoansModel(FinancialAccount fa, Agreement ag, FinancialAccountProduct fap, AgreementItem agreementItem, decimal totalPayments, DateTime date)
        {
            if (agreementItem == null)
                this.InterestRate = agreementItem.InterestRate;

            var loanAccount = fa.LoanAccount;
            this.LoanId = loanAccount.FinancialAccountId;
            this.LoanProduct = fap.FinancialProduct.Name;
            this.LoanAmount = loanAccount.LoanAmount;
            this.LoanTerm = agreementItem.LoanTermLength;
            this.LoanReleaseDate = loanAccount.LoanReleaseDate;
            this.LoanBalance = loanAccount.LoanBalance + totalPayments;
            this.MaturityDate = fa.LoanAccount.MaturityDate;
            this.LoanTerm = agreementItem.LoanTermLength;
            this.InterestRate = agreementItem.InterestRate;
            var status = loanAccount.LoanAccountStatus.OrderByDescending(entity => entity.TransitionDateTime <= date).FirstOrDefault();
            this.Status = status.LoanAccountStatusType.Name;

            var partyRole = fa.FinancialAccountRoles.SingleOrDefault(entity => entity.FinancialAccountId == fa.Id &&
                entity.PartyRole.RoleTypeId == RoleType.OwnerFinancialType.Id).PartyRole;
            var party = partyRole.Party;
            if (party.PartyTypeId == PartyType.PersonType.Id)
            {
                Person personAsCustomer = party.Person;

                this.Name = StringConcatUtility.Build(" ", personAsCustomer.LastNameString + ","
                    , personAsCustomer.FirstNameString, personAsCustomer.MiddleInitialString,
                    personAsCustomer.NameSuffixString);
            }
        }