Deleting ToDo Documents/ Assignments

Hi all, I am trying to use a custom script to automatically delete ToDo documents/ assignments for Issues just to keep things tidy when reassigning technicians. My trouble is that ToDo documents use the built in hash function and they don’t have the doc name in the form- it’s only stored in the database. The best that I have been able to do is cancel the previous assignment but that doesn’t delete it and can end up making everything messy. Any help would be greatly appreciated.