Allow deletion of media that are associated with galleries.

Right now the way the mapping is set up there is no cascade of deletes from the Media to the GalleryHasMedia. This means that if you attempt to delete Media and there are still GalleryHasMedia entities pointing at it you get a foreign key error.

Closes #576

Cascade removal from Media to GalleryHasMedia.
Why does it depend on the use case? The way its set up right now if you call modelManager->delete($media) you get an exception unless the media is not being used in any galleries. This means the delete button in the media admin is broken.