private bool ValidateLoanSummaryVm(LoanSummaryVm vm)
        {
            var deliveryDate = new DateTime(vm.DeliveryDate.Year, vm.DeliveryDate.Month, vm.DeliveryDate.Day);

            if (vm == null || deliveryDate < DateTime.Today || vm.Deposit > vm.FullPrice || vm.Deposit < (vm.FullPrice * Convert.ToDecimal(0.15)))
            {
                return(false);
            }
            return(true);
        }
        public async Task <ActionResult <LoanDetailsVm> > Post([FromBody] LoanSummaryVm loanSummary)
        {
            try
            {
                if (!ValidateLoanSummaryVm(loanSummary) || !ValidateSettings() || !ModelState.IsValid)
                {
                    throw new Exception("invalid model");
                }

                loanSummary.ArrangmentFee = Convert.ToDecimal(_settings.Value.ArrangementFee);
                loanSummary.CompletionFee = Convert.ToDecimal(_settings.Value.CompletionFee);

                var loanDetails = await _service.CalculateLoan(_mapper.MapLoanSummaryVmToLoanSummary(loanSummary));

                return(Ok(_mapper.MapConvertLoanDetailsToLoanDetailsVm(loanDetails)));
            }
            catch (Exception ex)
            {
                //ToDo: log exception

                return(BadRequest(ex));
            }
        }