Add internal schema for entities.

Fixes #428