load method query re wrote decomposing the query in to two

In this pull request I have changed the _load() method's query by decomposing it in to two. One part is to get the in-published categories and the other is to get the categories. Previous query had this in-published category filtering in the same query using a left join. In the new query the process has been optimized by using the NOT IN operation in order to check the availability of the in-published categories.
#the bug
we need group by clause

GROUP BY c.id