fixes #6216 - foreign key errors such as deleting a subnet that is associated with a host group and others