Refactor doc.to_admin_form
Make sure dependent related docs are deleted when main doc is deleted