private void UpdateClientProfileTakenCredits(TakeCreditModel model)
 {
     model.ClientId = this.ResolveClientId(model.ClientId);
     var client = this._clientProfileService.GetClient(model.ClientId);
     var loanProduct = this._creditService.GetLoanProduct(model.CreditProductId);
     this.loanRequestsService.CreateLoanRequest(client, loanProduct, model.Sum, model.PeriodInMonth);
 }
        public ActionResult TakeCredit(TakeCreditModel model)
        {
            Contract.Requires<ArgumentNullException>(model.IsNotNull());
            var error = "true";
            try
            {
                this.UpdateClientProfileTakenCredits(model);
            }
            catch (WorkflowException)
            {
                throw;
            }
            catch (Exception e)
            {
                error = e.Message;
            }

            return this.Json(error);
        }