public void ChangeItemsFilter(Action <IWhereCollector <T> > filterFunction, int filterApplyOrder)
        {
            RememberFilter(filterFunction, filterApplyOrder);
            var collector = new PassToLinqWhereCollector <T>(_allItems);

            _latestFilters.Where(x => x != null).ForEach(x => x(collector));

            var newVisibleItems = collector.GetFilteredResult().ToArray();

            //simulate that all visible-till-now items are removed...
            var oldVisibleItems = _visibleItems.ToArray();

            Logger.Debug(GetType(), "Removing all rows as filter changed will likely demand it. {0} items", oldVisibleItems.Length);

            _visibleItems.Clear();

            //... and simulate that visible set is added now
            _visibleItems.AddRange(newVisibleItems);
            RebuildIdx();
            Logger.Debug(GetType(), "Filtering caused that {0} rows are visible now", newVisibleItems.Length);

            Changed?.Invoke(0, newVisibleItems, oldVisibleItems);
        }
        public void ChangeItemsSorting(Action <IOrderByCollector <T> > collect)
        {
            var orderingCollector = new PassToLinqOrderByCollector <T>(_allItems);

            collect(orderingCollector);

            var newAllItems = orderingCollector.GetSortedResult().ToList();

            T[] newVisibleItems;

            if (!_latestFilters.Any() || _latestFilters.All(x => x == null))
            {
                newVisibleItems = newAllItems.ToArray();
            }
            else
            {
                var filteringCollector = new PassToLinqWhereCollector <T>(newAllItems);
                _latestFilters.Where(x => x != null).ForEach(x => x(filteringCollector));
                newVisibleItems = filteringCollector.GetFilteredResult().ToArray();
            }

            //simulate that all visible-till-now items are removed...
            var oldVisibleItems = _visibleItems.ToArray();

            Logger.Debug(GetType(), "Removing all rows as order change will likely demand it");

            _visibleItems.Clear();

            //... and simulate that visible set is added now
            _allItems = newAllItems;
            _visibleItems.AddRange(newVisibleItems);
            RebuildIdx();

            Logger.Debug(GetType(), "Filtering caused that {0} rows are visible now", newVisibleItems.Length);

            Changed?.Invoke(0, newVisibleItems, oldVisibleItems);
        }