public function buildDocumentFromPathsAndValues(array $paths, array $values)
    {
        $this->validateBatch($paths, FieldPath::class);

        $output = [];

        foreach ($paths as $pathIndex => $path) {
            $keys = $path->path();
            $num = count($keys);

            $val = $values[$pathIndex];
            foreach (array_reverse($keys) as $index => $key) {
                if ($num >= $index+1) {
                    $val = [
                        $key => $val
                    ];
                }
            }

            $output = $this->arrayMergeRecursive($output, $val);
        }

        return $output;
    }