public static IEnumerable <ObjectId> FilterIntities(this Database db, Func <ObjectId, bool> filterFunction, bool doValidChecks = true)
        {
            ObjectId result = ObjectId.Null;

            foreach (Handle hnd in GenerateHandles(db))
            {
                if (db.TryGetObjectId(hnd, out result) && (!doValidChecks || result.CheckValid()) && filterFunction(result))
                {
                    yield return(result);
                }
            }
        }