refactoring the buildHasManyDelete method a bit.