Code Duplication    Length = 11-12 lines in 2 locations

src/Form.php 2 locations

@@ 539-550 (lines=12) @@
536
            return $response;
537
        }
538
539
        DB::transaction(function () {
540
            $updates = $this->prepareUpdate($this->updates);
541
542
            foreach ($updates as $column => $value) {
543
                /* @var Model $this->model */
544
                $this->model->setAttribute($column, $value);
545
            }
546
547
            $this->model->save();
548
549
            $this->updateRelation($this->relations);
550
        });
551
552
        if (($result = $this->callSaved()) instanceof Response) {
553
            return $result;
@@ 388-398 (lines=11) @@
385
            return $response;
386
        }
387
388
        DB::transaction(function () {
389
            $inserts = $this->prepareInsert($this->updates);
390
391
            foreach ($inserts as $column => $value) {
392
                $this->model->setAttribute($column, $value);
393
            }
394
395
            $this->model->save();
396
397
            $this->updateRelation($this->relations);
398
        });
399
400
        if (($response = $this->callSaved()) instanceof Response) {
401
            return $response;