MDL-41114 Avoid unnecessary retrieving of coursecat from DB