Ground work for QueryEntity serialization and deserialization

Change-Id: Ie301acfee48c3f525fef10bd46856521db29ea86