public function toArray($recursive = true)
    {
        $results     = [];
        $collections = $this->collections;

        if ($recursive) {
            foreach ($collections as $key => $value) {
                if ($value instanceof CollectionInterface) {
                    /** @noinspection PhpMethodParametersCountMismatchInspection */
                    $results[$key] = $value->toArray($recursive);
                } else {
                    $results[$key] = $value;
                }
            }
        } else {
            foreach ($collections as $key => $value) {
                $results[$key] = $value;
            }
        }

        return $results;
    }