Introducing the EntityEncoder type, to handle different entities

In preparation for #105 (which might also be of interest for me), I'd suggest to create an Interface, which describes how Entities should be handled.

What do you think?