The clean up task had an issue to clean up to many files.
It didn't check if a file that could be deleted
because one event got deleted, was still in use by another event.
Relates: #10499
Adjust existing code base to not use hardcoded file path.
Instead use info from database and check all files which have references
to event objects.
Also add test to cover feature.
Properly cleanup system.
Delete further records when deleting everything.
Also respect further records when purging old entries.
Respect:
* sys_category_record_mm
* sys_file_reference
* sys_file_metadata