/**
  * Save the tree.
  *
  * @param TreeBuilder $builder
  * @param array       $items
  * @param null        $parent
  */
 public function save(TreeBuilder $builder, array $items = [], $parent = null)
 {
     $model = $builder->getTreeModel();
     $items = $items ?: $builder->getRequestValue('items');
     foreach ($items as $index => $item) {
         /* @var EloquentModel $entry */
         $entry = $model->find($item['id']);
         $entry->{$builder->getTreeOption('sort_column', 'sort_order')} = $index + 1;
         $entry->{$builder->getTreeOption('parent_column', 'parent_id')} = $parent;
         $entry->save();
         if (isset($item['children'])) {
             $this->save($builder, $item['children'], $item['id']);
         }
     }
 }