Test RemoteId changing and cache updating.

Test that the RemoteId is correctly updated by Merge and that the model
caches update their indices with new data as well.
Fix cache updating bug introduced by previous refactor.

When refactoring model lookup code into ModelManager (b87aaed), a subtle
bug was introduced where looking up the cache for a model failed. This
simple typo is now fixed with added unit tests (2c34ee4) to make sure
this wouldn't happen in the future.