All policitians page - optimize SQL

Moved all query-related code to Model and optimized query
to get around the problem with pagination GEM and grouped
queries.