Bentley Map v8i SS4 C# plugin: Erasing instances ECCriteria problem


I'm trying to use GDIEraseProcessor to erase instances, but I have no idea how I can get/create ECCriteria that is first parameter of Erase instances method.

As I understand it will provide the selection criteria of features to be erased.

So far I was trying get it from StorageImports criteria, as simply I found this property there satisfying expected interface of a parameter, but it is set to null  (probably it has different purpose in this class).

What I want to achieve is to erase only Selected instances so I don't even need to provide any "where clauses", but if provided criteria is null it erases everything.

Does anyone have an idea how to do it? Thanks in advance.

My code:

GDI.GDIEraseProcessor ep = new GDI.GDIEraseProcessor();

//trying to get selection critieria from IImportCriteria, which is not working

IImportCriteria criteria = GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport;
criteria.Geometry = null;
criteria.SpatialArea = SpatialArea.Selection;
IStorageImportCriteria storageImp = criteria.StorageImports[0] as IStorageImportCriteria;
IECCriteria selectionCritieria = storageImp?.ECCriteria;

if (selectionCritieria != null)
ep.EraseInstances(selectionCritieria, storageImp);