public void ReplaceWithMonsterNest(Terrain terrain, ILocation location) { var tempLoc = new MonsterNest(location); foreach (var loc in terrain) { var neigbors = loc.ListOfNeighbors(); //.Cast<Dictionary<Directions, ILocation>>().Where(l => l.TryGetValue(location)); foreach (var neig in neigbors.Where(l=>l.Value == location)) { neig.Value.RemoveNeighbor(neig.Key); neig.Value.AddNeighbor(tempLoc, neig.Key); } } terrain.RemoveLocation(location); }