public async Task <HttpResponseMessage> PutMortgage(BusinessLayer.Models.Presentation.Requests.Mortgage.Mortgage collateral)
        {
            if (collateral == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral")));
            }

            var dtoCollateral = (BusinessLayer.Models.Dto.Mortgage.Mortgage)collateral;

            dtoCollateral.ModifyDate = DateTime.UtcNow;
            await _service.PutCollateralAsync(dtoCollateral);


            if (!string.IsNullOrEmpty(collateral.Settlement.Name) && !string.IsNullOrEmpty(collateral.Street))
            {
                string address = string.Format(collateral.Region.Name + ", " + collateral.SettlementType.Name + " " + collateral.Settlement.Name + ", " + collateral.Street + " " + collateral.House);
                await СheckingAndPostGeoLocation(dtoCollateral.Id, dtoCollateral.Type, address);
            }

            await _unitOfWorkAsync.SaveChangesAsync();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
        public async Task <HttpResponseMessage> PostMortgageToCreditagreement(string id, BusinessLayer.Models.Presentation.Requests.Mortgage.Mortgage collateral)
        {
            if (collateral == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral")));
            }

            var    dtoCollateral = (BusinessLayer.Models.Dto.Mortgage.Mortgage)collateral;
            string responseObj   = await _service.PostCollateralToCreditagreementAsync(id, dtoCollateral);

            await _unitOfWorkAsync.SaveChangesAsync();

            if (string.IsNullOrEmpty(responseObj))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Ошибка при создании залога"));
            }

            //GEO
            if (!string.IsNullOrEmpty(dtoCollateral.Settlement.Name) && !string.IsNullOrEmpty(dtoCollateral.Street))
            {
                string address = string.Format(dtoCollateral.Region.Name + ", " + dtoCollateral.SettlementType.Name + " " + dtoCollateral.Settlement.Name + ", " + dtoCollateral.Street + " " + dtoCollateral.House);
                await СheckingAndPostGeoLocation(responseObj, dtoCollateral.Type, address);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, responseObj));
        }