public void ProcessContract(Contract contract, int months) { double basicQuota = contract.TotalValue / months; for (int i = 1; i <= months; i++) { DateTime date = contract.Date.AddMonths(i); double updatedQuota = basicQuota + _onlinePaymentService.Interest(basicQuota, i); double fullQuota = updatedQuota + _onlinePaymentService.PaymentFree(updatedQuota); contract.AddInstallments(new Installment(date, fullQuota)); } }