protected function getSubtreeAsArray($data, $serialiseEval)
    {
        $output = $data;

        // Serialise node
        $serialised = $serialiseEval($data['node']);

        // Force serialisation of DBField instances
        if (is_array($serialised)) {
            foreach ($serialised as $key => $value) {
                if ($value instanceof DBField) {
                    $serialised[$key] = $value->getSchemaValue();
                }
            }

            // Merge with top level array
            unset($output['node']);
            $output = array_merge($output, $serialised);
        } else {
            if ($serialised instanceof DBField) {
                $serialised = $serialised->getSchemaValue();
            }

            // Replace node with serialised value
            $output['node'] = $serialised;
        }

        // Replace children with serialised elements
        $output['children'] = [];
        foreach ($data['children'] as $child) {
            $output['children'][] = $this->getSubtreeAsArray($child, $serialiseEval);
        }
        return $output;
    }