create new entity when no events are to be replayed
store entity type so we can make sure an existing UID isn't reused by a different entity
Saving entities with uid and entity type

We need to raise an exception when an entity of a different type
already exists in the database for the same UID. That's because
we'll load entities from all events with a UID. We can't have
events for different entities mix.

Also, use Sequel methods instead of creating our own sql code.