Currently content items or search selections can be deleted (of /admin/content and /admin/search-selection) when they are referenced somewhere else in the database. This should not be allowed, to keep the database consistent.
Because we don't know which bundles are loaded or which custom documents have been made the fields that contain a reference to the current class must be determined automatically. This can be done with this code: https://gist.github.com/zarathustra323/9551530. After that all found fields need to be queried to see if the document that will be deleted is in use somewhere.
When the document is still in use an error message needs to be shown: This item is still on use by <a href="">item name</a>
The "by <a href..." part will only be shown if they object is instanceof Article, otherwise you don't know the title and where to link to.
Note: please don't write this code in the controller, maybe a service or event listener.