Added more flexible OData query generation

* Basic OData query generator
* Integrated with the existing method for pulling events