Fix a move-related issue
Fix a move-related issue

`schema` is captured from the enclosing scope by reference, and the only condition in which it's safe to move a value out of it is if the lambda returns `true` (and the enclosing function immediately returns). Otherwise, we attempt to use `schema` afterwards, causing issues since it no longer contains the values we expect.

realm/realm-core,realm/realm-core,realm/realm-core,realm/realm-core,realm/realm-core,realm/realm-core,realm/realm-object-store,realm/realm-object-store,realm/realm-object-store,realm/realm-core