private NearbyPlace toNearbyPlace(RequestBean request, SearchLocation location)
            throws CitysearchException {
        NearbyPlace nearbyPlace = new NearbyPlace();

        String addr = Utils.getLocationString(location.getCity(), location.getState());
        nearbyPlace.setStreet(location.getStreet());
        nearbyPlace.setCity(location.getCity());
        nearbyPlace.setState(location.getState());
        nearbyPlace.setPostalCode(location.getPostalCode());
        nearbyPlace.setLocation(addr);

        String adUnitIdentifier = request.getAdUnitIdentifier();

        StringBuilder nameLengthProp = new StringBuilder(adUnitIdentifier);
        nameLengthProp.append(".");
        nameLengthProp.append(CommonConstants.NAME_LENGTH);

        String name = location.getName();
        name = Utils.getAbbreviatedString(name, nameLengthProp.toString());
        nearbyPlace.setName(name);

        String rating = location.getRating();
        List<Integer> ratingList = Utils.getRatingsList(rating);
        double ratings = Utils.getRatingValue(rating);
        nearbyPlace.setRating(ratingList);
        nearbyPlace.setRatings(ratings);

        String reviewCount = location.getReviewCount();
        int userReviewCount = Utils.toInteger(reviewCount);
        nearbyPlace.setReviewCount(userReviewCount);

        // Calculate distance only if lat&lon passed in request
        if (!StringUtils.isBlank(request.getLatitude())
                && !StringUtils.isBlank(request.getLongitude())
                && !StringUtils.isBlank(location.getLatitude())
                && !StringUtils.isBlank(location.getLongitude())) {
            BigDecimal sourceLat = new BigDecimal(request.getLatitude());
            BigDecimal sourceLon = new BigDecimal(request.getLongitude());
            BigDecimal destLat = new BigDecimal(location.getLatitude());
            BigDecimal destLon = new BigDecimal(location.getLongitude());
            double distance = Utils.getDistance(sourceLat, sourceLon, destLat, destLon);
            
            Properties appProperties = PropertiesLoader.getApplicationProperties();
            String propValue = appProperties.getProperty(CommonConstants.DISTANCE_DISPLAY_CUTOFF);
            if (!StringUtils.isBlank(propValue) && StringUtils.isNumeric(propValue)) {
                double nPropValue = Double.valueOf(propValue);
                distance = (distance > nPropValue) ? -1 : distance;
            }
            nearbyPlace.setDistance(distance);
        } else {
            nearbyPlace.setDistance(-1);
        }

        nearbyPlace.setListingId(location.getListingId());

        StringBuilder tagLengthProp = new StringBuilder(adUnitIdentifier);
        tagLengthProp.append(".");
        tagLengthProp.append(CommonConstants.TAGLINE_LENGTH);
        String category = location.getCategory();
        category = Utils.getAbbreviatedString(category, tagLengthProp.toString());
        nearbyPlace.setCategory(category);

        nearbyPlace.setAdDisplayURL(location.getAdDisplayUrl());
        nearbyPlace.setAdImageURL(location.getImageUrl());
        nearbyPlace.setPhone(location.getPhone());
        nearbyPlace.setOffers(location.getOffers());

        nearbyPlace.setCallBackFunction(request.getCallBackFunction());
        nearbyPlace.setCallBackUrl(request.getCallBackUrl());

        String adDisplayTrackingUrl = Utils.getTrackingUrl(nearbyPlace.getAdDisplayURL(), null,
                request.getCallBackUrl(), request.getDartClickTrackUrl(),
                nearbyPlace.getListingId(), nearbyPlace.getPhone(), request.getPublisher(),
                request.getAdUnitName(), request.getAdUnitSize());
        nearbyPlace.setAdDisplayTrackingURL(adDisplayTrackingUrl);

        String callBackFn = Utils.getCallBackFunctionString(request.getCallBackFunction(),
                nearbyPlace.getListingId(), nearbyPlace.getPhone());
        nearbyPlace.setCallBackFunction(callBackFn);

        return nearbyPlace;
    }