Add Entity#to_h

[Closes #94]
love to hear feedbacks on how to refactor this ugly condition for the sake of passing our tests