public static function getUniqueColumnElements(array $array, $elementKey = null)
    {
        if (is_null($elementKey)) {
            return array_unique($array);
        }

        $uniqueElements = [];
        foreach ($array as $key => $value) {
            if (is_array($value) && isset($value[$elementKey])) {
                $value = $value[$elementKey];
            } elseif (is_object($value) && property_exists($value, $elementKey)) {
                $value = $value->{$elementKey};
            } else {
                continue;
            }
            if (!in_array($value, $uniqueElements, true)) {
                $uniqueElements[] = $value;
            }
        }
        return $uniqueElements;
    }