Add count method

This adds a count method in model. The query method surpresses anything but result, so it is not possible to use the count parameter with it.