public static function syncHasMany($model, $campo, $children_items, $config) {
        $children = $model->{$campo};
        $children_items = collect($children_items);
        $deleted_ids = $children->filter(
                        function ($child) use ($children_items) {
                    return empty(
                            $children_items->where($config[$campo]['id'], $child->$config[$campo]['id'])->first()
                    );
                }
                )->map(function ($child) {
            $id = $child->id;
            $child->delete();
            return $id;
        }
        );
        $attachments = $children_items->filter(
                        function ($children_item) {
                    return empty($children_item->$config[$campo]['id']);
                }
                )->map(function ($children_item) use ($deleted_ids) {
            $children_item->$config[$campo]['id'] = $deleted_ids->pop();
            return new $config[$campo]['modelo']($children_item);
        });
        $model->{$campo}()->saveMany($attachments);
    }