public static function arrayPartition(array $raw, $key, $keepKey = true)
    {
        $result = array();

        foreach ($raw as $index => $collection) {
            // Make the the root partition exists
            if (!isset($collection[$key])) {
                throw new LogicException(sprintf(
                    'The key "%s" does not exist in provided collection', $key
                ));
            }

            // Extract module' name as a key and put the rest into its values
            $target = array($collection[$key] => $collection);

            
            foreach ($target as $module => $array) {
                // When doesn't exist, then need to create a one
                if (!isset($result[$module])) {
                    $result[$module] = array();
                }

                if ($keepKey == false) {
                    unset($array[$key]);
                }

                $result[$module][] = $array;
            }
        }

        return $result;
    }