private static function processReindexPath($path)
    {
        if (is_string($path) || is_integer($path)) {
            // Single level path - one element only
            $path = array(array($path));
        } elseif (is_array($path) && !empty($path) && !is_array($path[0])) {
            // Single level path - multiple elements
            // Check each path element is either a string or an integer
            foreach ($path as $key) {
                if (!(is_string($key) || is_integer($key))) {
                    throw new InvalidArgumentException('Invalid reindex path.');
                }
            }

            $path = array($path);
        } elseif (is_array($path) && !empty($path) && is_array($path[0])) {
            // Multilevel path
            // Check each path element is an array (a sub-path)
            foreach ($path as $subpath) {
                if (!is_array($subpath) || empty($subpath)) {
                    throw new InvalidArgumentException('Invalid reindex path.');
                }

                // Check each sub-path element is a valid array key (either a string or an integer)
                foreach ($subpath as $key) {
                    if (!(is_string($key) || is_integer($key))) {
                        throw new InvalidArgumentException('Invalid reindex path.');
                    }
                }
            }
        } else {
            throw new InvalidArgumentException('Invalid reindex path.');
        }

        return $path;
    }