public async Task <FloodingAddress> GetStreetDetails(Address address)
        {
            var addressResponse = await _verintServiceGateway.GetPropertyByUprn(address.PlaceRef);

            if (addressResponse?.ResponseContent != null)
            {
                var streetResponse = await _verintServiceGateway.GetStreetByUsrn(addressResponse.ResponseContent.USRN);

                var response = streetResponse.ResponseContent.FirstOrDefault();

                return(new FloodingAddress
                {
                    Name = response.Name,
                    USRN = response.USRN,
                    UniqueId = response.UniqueId,
                    Easting = addressResponse.ResponseContent.Easting,
                    Northing = addressResponse.ResponseContent.Northing
                });
            }

            return(new FloodingAddress
            {
                Name = address.SelectedAddress,
                USRN = address.PlaceRef
            });
        }
        public async Task <EligibleStreet> GetAddressDetails(string yourAddress)
        {
            var verintResponse = await _verintServiceGateway.GetPropertyByUprn(yourAddress);

            if (!verintResponse.IsSuccessStatusCode || verintResponse == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound,
                                                $"{nameof(PermitHelper)}: {nameof(GetAddressDetails)}: " +
                                                $"{nameof(_verintServiceGateway)} {nameof(PermitHelper.GetAddressDetails)} " +
                                                $"failed with {verintResponse.StatusCode}");
            }

            var eligibleStreets = new List <EligibleStreet>();

            try
            {
                using StreamReader permitsStream = new StreamReader(EslPath);
                eligibleStreets = JsonConvert.DeserializeObject <List <EligibleStreet> >(permitsStream.ReadToEnd());
            }
            catch (Exception ex)
            {
                throw new Exception($"PermitHelper::GetAddressDetails, an exception has occured while fetching esl json data datasource: {ex}");
            }

            var verintAddress = verintResponse.ResponseContent;

            var numberOfEligibleStreets = eligibleStreets.Count(address =>
                                                                !string.IsNullOrEmpty(address.USRN) &&
                                                                address.USRN.Equals(verintAddress.USRN) &&
                                                                string.Equals(address.POSTCODE, verintAddress.Postcode, StringComparison.CurrentCultureIgnoreCase));

            if (numberOfEligibleStreets > 1)
            {
                return new EligibleStreet {
                           Area = PermitConstants.DUPLICATE
                }
            }
            ;

            var isComplexAddress = eligibleStreets.Any(address =>
                                                       !string.IsNullOrEmpty(address.USRN) && address.USRN.Equals(verintAddress.USRN) && address.POSTCODE.Contains(verintAddress.Postcode) && address.COMPLEX.Trim().ToLower().Equals("y"));

            if (isComplexAddress)
            {
                return new EligibleStreet {
                           Area = PermitConstants.DUPLICATE
                }
            }
            ;

            var numberOfDuplicate = eligibleStreets.Where(address =>
                                                          !string.IsNullOrEmpty(address.USRN) && address.USRN.Equals(verintAddress.USRN) && address.POSTCODE.Contains(verintAddress.Postcode));

            if (numberOfDuplicate.Count() > 1)
            {
                return new EligibleStreet {
                           Area = PermitConstants.DUPLICATE
                }
            }
            ;

            var foundEslAddress = eligibleStreets.Where(address =>
                                                        address.POSTCODE.Contains(verintAddress.Postcode) &&
                                                        !string.IsNullOrEmpty(address.USRN) &&
                                                        address.USRN.Equals(verintAddress.USRN));

            if (foundEslAddress.Count() > 0 || foundEslAddress != null)
            {
                foreach (var eslAddress in foundEslAddress)
                {
                    if (eslAddress.HouseNumbers != null && eslAddress.HouseNumbers.Count > 0)
                    {
                        return(eslAddress.HouseNumbers.Any(_ => _.Equals(verintAddress.Number)) ? eslAddress : null);
                    }

                    return(eslAddress);
                }
            }
            return(null);
        }