Clearing HABTM (unique) when HABTM array is empty, refs #2461
Merge pull request #4429 from jeremyharris/issue-2461

Clearing HABTM (unique) when HABTM array is empty. Fixes #2461