Put var declaration in correct spot
Fixes several embedded bugs.

1. Ensure that embedded records returned in
   payloads containing multiple records (e.g.,
   in responses to queries or "find alls") are
   extracted.
2. Make sure that loading records with embedded
   data multiple times is handled correctly.
new records should resolve the promise
Merge pull request #577 from tchak/resolve-new-records

new records should resolve the promise