public async Task <List <WoodyPlantDocument> > GetByFilterAsync(WoodyPlantFilterModel filter, WoodyPlantSortModel sort, CancellationToken cancellationToken)
        {
            if (filter is null)
            {
                throw new ArgumentNullException(nameof(filter));
            }
            if (sort is null)
            {
                throw new ArgumentNullException(nameof(sort));
            }

            var cursor = await Collection.FindAsync(
                filter.ToFilterDefinition(),
                sort.ToFindOptions(filter.Skip, filter.Take, filter.Text != null),
                cancellationToken);

            var plants = new List <WoodyPlantDocument>();

            while (await cursor.MoveNextAsync(cancellationToken))
            {
                plants.AddRange(cursor.Current);
            }

            return(plants);
        }
        public async Task <long> CountByFilterAsync(WoodyPlantFilterModel filter, CancellationToken cancellationToken)
        {
            if (filter.Point != null)
            {
                return(-1);
            }

            return(await Collection.CountDocumentsAsync(filter.ToFilterDefinition(), cancellationToken : cancellationToken));
        }