Modify order of delete operations to avoid foreign key constraints