Add a method to get the count of a resource.