we also use the same method in `TermsAggregatorFactory`... would be great to rename `BucketUtils` class to `BucketsAggregatorsUtils` and move this method there (and also change `TermsAggregatorFactory` to use it)