protected function prepareDatatablesStructure(
        \Illuminate\Http\Request $request,
        Collection $collection,
        $totalCount,
        $filteredCount
    ) {
        $columns = $this->getColumns();

        $result = [];
        $result['draw'] = $request->input('draw', 0);
        $result['recordsTotal'] = $totalCount;
        $result['recordsFiltered'] = $filteredCount;
        $result['data'] = [];

        foreach ($collection as $instance) {
            $_row = [];

            foreach ($columns->all() as $column) {
                $column->setModel($instance);

                if ($column instanceof Control) {
                    $column->initialize();
                }

                $_row[] = (string) $column;
            }

            $result['data'][] = $_row;
        }

        return $result;
    }