added count method to get total count of all medias
refactored query to use a specific server (only one server hit per query)