Split tests in multiple files
Do not create an index manually.

Sqlite already does this for UNIQUE columns
Add a duplicate media unit test
SqliteTools: Fix infinite loop in error cases
Clear cache when releasing the media library
Rework object creation & insertion to cache to avoid invalid states.

Objects were always created and added to cache, regardless of their
status in DB