public static function groupByColumn(array $array, $keyColumn, $valueColumn = null): array
    {
        $result = [];

        foreach ($array as $item) {
            if (!isset($item[$keyColumn])) {
                continue;
            }

            $key = $item[$keyColumn];
            if (!isset($result[$key])) {
                $result[$key] = [];
            }

            if (null !== $valueColumn) {
                $result[$key][] = $item[$valueColumn];
            } else {
                $result[$key][] = $item;
            }
        }

        return $result;
    }