More identity checks and tests.
Updates following review.
More updates.
Tweaks.
Merge pull request #347 from howbazaar/identity-in-state

Initial identity collection in the database

Define the initial identity structure in the database, and tests.