Fix a regression that broke moving libraries in 1.0

Fixes #1216401 [calibre, version 1.0.0 'function' object has no attribute 'exists_at'](https://bugs.launchpad.net/calibre/+bug/1216401)
newdb: Handle multiple different case items when setting many-many fields

Fixes #1216398 [Same tag twice in different case causes ConstraintError](https://bugs.launchpad.net/calibre/+bug/1216398)