public void DeleteLoanPayment(Guid loanPaymentId)
        {
            string errMsg = $"Delete failed, a loan payment with id '{loanPaymentId}' could not be found!";

            LoanPayment found =
                ((List <LoanPayment>)LoanPayments).Find(p => p.Id == loanPaymentId)
                ?? throw new InvalidOperationException(errMsg);

            _loanPayments.Remove(found);
        }
        public void UpdateLoanPayment(LoanPayment payment)
        {
            string errMsg = $"Update failed, a loan payment with id '{payment.Id}' could not be found!";

            LoanPayment found =
                ((List <LoanPayment>)LoanPayments).Find(p => p.Id == payment.Id)
                ?? throw new InvalidOperationException(errMsg);

            found.UpdateLoanInterestAmount(payment.LoanInterestAmount);
            found.UpdatePaymentNumber(payment.PaymentNumber);
            found.UpdatePaymentDueDate(payment.PaymentDueDate);
            found.UpdateLoanPrincipalAmount(payment.LoanPrincipalAmount);
            found.UpdateLoanInterestAmount(payment.LoanInterestAmount);
            found.UpdateLoanPrincipalRemaining(payment.LoanPrincipalRemaining);
            found.UpdateUserId(payment.UserId);
        }
 public void AddLoanPayment(LoanPayment payment)
 {
     //TODO check for duplicate loan payment
     _loanPayments.Add(payment);
 }