Added unittests
Use EntityFactory in examples