         return RemoteConfigKeys.searchRadiusInKm.value
     }()
 
-    fileprivate lazy var places = [Place]()
+    fileprivate var displayedPlaces = [Place]() {
+        didSet {
+            var placesMap = [String: Int]()
+            for (index, place) in displayedPlaces.enumerated() {
+                placesMap[place.id] = index
+            }
+            self.placeKeyMap = placesMap
+        }
+    }
+    fileprivate var placeKeyMap = [String: Int]()
 
     fileprivate var firstFetch = true
 


    convenience init(places: [Place]) {
        self.init()
        self.places = places
    }

    func place(forKey key: String, callback: @escaping (Place?) -> ()) {

    }

    func allPlaces() -> [Place] {
        return displayedPlaces
    }

    func sortPlaces(byLocation location: CLLocation) {
        self.placesLock.withWriteLock {
            let sortedPlaces = PlaceUtilities.sort(places: displayedPlaces, byDistanceFromLocation: location)
            self.displayedPlaces = sortedPlaces
        }
    }
}
