3368101: Only take snapshot when entity ID exists
Handles #3368101 by ensuring that snapshots are only created for entities with a non-null entity ID.
Handles #3368101 by ensuring that snapshots are only created for entities with a non-null entity ID.