HOTFIX: better fix for the problem of orphan graphs. JIRA DIGIPAL-523. This will work even for bulk delete of image or annotation records.