/**
  * Populate level & path for items.
  *
  * @param   array  $items  Array of stdClass objects
  *
  * @return  array
  *
  * @since   3.6.3
  */
 private function populateExtraData(array $items)
 {
     // First pass: get list of the group id's and reset the counts.
     $groupsByKey = array();
     foreach ($items as $item) {
         $groupsByKey[(int) $item->id] = $item;
     }
     $groupIds = array_keys($groupsByKey);
     $db = $this->getDbo();
     // Get total enabled users in group.
     $query = $db->getQuery(true);
     // Count the objects in the user group.
     $query->select('map.group_id, COUNT(DISTINCT map.user_id) AS user_count')->from($db->quoteName('#__user_usergroup_map', 'map'))->join('LEFT', $db->quoteName('#__users', 'u') . ' ON ' . $db->quoteName('u.id') . ' = ' . $db->quoteName('map.user_id'))->where($db->quoteName('map.group_id') . ' IN (' . implode(',', $groupIds) . ')')->where($db->quoteName('u.block') . ' = 0')->group($db->quoteName('map.group_id'));
     $db->setQuery($query);
     try {
         $countEnabled = $db->loadAssocList('group_id', 'count_enabled');
     } catch (RuntimeException $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Get total disabled users in group.
     $query->clear('where')->where('map.group_id IN (' . implode(',', $groupIds) . ')')->where('u.block = 1');
     $db->setQuery($query);
     try {
         $countDisabled = $db->loadAssocList('group_id', 'count_disabled');
     } catch (RuntimeException $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Inject the values back into the array.
     foreach ($groupsByKey as &$item) {
         $item->count_enabled = isset($countEnabled[$item->id]) ? (int) $countEnabled[$item->id]['user_count'] : 0;
         $item->count_disabled = isset($countDisabled[$item->id]) ? (int) $countDisabled[$item->id]['user_count'] : 0;
         $item->user_count = $item->count_enabled + $item->count_disabled;
     }
     $groups = new JHelperUsergroups($groupsByKey);
     return array_values($groups->getAll());
 }