Finished implementation of QueryEntitySerializer and added integration test

PP'd with addshore

Change-Id: If8878e877d37dcdd6f87b477081a1690befdb609