Refactoring the cache building processes.

Refactorings to the cache building process for navigation and locale.

* Extract cache building to external classes
* Use dependency injection to inject the database in the CacheBuilders
* Split up massive methods in smaller (even testable) functions.

What could still be done

* Extract a base CacheBuilder class (it could contain the getCacheHeader method and some common functionality with the fileSystem component)
* Add automatic tests
* Refactor to make sure the cache builder doesn't do database queries.

It's already a big improvement in the complexity of these methods now. (And it removes some duplicate code between front and backend)