A bunch of tests for the Entity class functions and features. Bug fix in JSON serialization of references.