public static function sortByCustomKeysOrder(array $array, array $keysOrder)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return null;
        }

        $ordered = [];

        /*
         * 1st iteration:
         * Get elements in proper / required order
         */
        if (!empty($keysOrder)) {
            foreach ($keysOrder as $key) {
                if (isset($array[$key])) {
                    $ordered[$key] = $array[$key];
                    unset($array[$key]);
                }
            }
        }

        /*
         * 2nd iteration:
         * Get the rest of elements
         */
        if (!empty($array)) {
            foreach ($array as $key => $element) {
                $ordered[$key] = $element;
            }
        }

        return $ordered;
    }