public void MapRoute(int routeId, string directions) { var coords = _plotter.CreateRoute(directions).ToList(); _routes.Add(new Route(routeId, coords)); foreach (var item in coords) { if (!_points.TryGetValue(item, out var routeIds)) { routeIds = new HashSet <int>(); _points.Add(item, routeIds); } routeIds.Add(routeId); } }