Fix errors when updating belongsToMany associations.

* Fix removing all linked records.
* Fix removing some linked records, but not adding new ones.

Refs #3485
Fix error in marshalling belongsToMany relations.

When removing all belongsTo associations `_ids` can be an empty scalar
value. The marshaller should handle empty scalar values gracefully.

Refs #3485
Merge pull request #3523 from cakephp/issue-3485

Fix issues saving belongsToMany associations