XD-332: REST aggregate counter

* Refactoring of service and repository.
* REST controller taking from, to and resolution parameters.