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.