Replace the tag repository

Replace the `TagRepository` module with methods on the `Tag` class.

This is mostly just refactoring, although some of the code that makes one database query per tag per artefact should now be more efficient.

Suggest we hold off merging this until the whole platform team has had a look over it.