Use get_item_count() method. Closes #3182.