public async Task AddInstancingOrderAsync( VegetationDetailLevel level, List <VegetationSubjectEntity> gainedEntities, List <VegetationSubjectEntity> lostEntities) { foreach (var entity in gainedEntities) { Preconditions.Assert(entity.Detail.SpeciesEnum == VegetationSpeciesEnum.Grass2SpotMarker, $"Given entity is not of type spotMarker. It is {entity.Detail.SpeciesEnum}"); var position = entity.Position2D; var generationArea = MyRectangle.CenteredAt(position, _configuration.GroupSize); var grassBandInfo = await _grassGroupsGrower.GrowGrassBandAsync(generationArea); _entityToGrassBand[entity.Id] = grassBandInfo; } foreach (var entity in lostEntities) { var id = entity.Id; var bandInfo = _entityToGrassBand[id]; _entityToGrassBand.Remove(id); _grassGroupsGrower.RemoveGrassBand(bandInfo); } }