Adding counter cache behavior
Merge pull request #2292 from ankr/counter-cache-behavior

3.0 - Counter cache behavior (WIP)