public function setOrder(array $records)
    {
        $config = $this->getConfig();
        $table = $this->_table;

        $table->removeBehavior('Sequence');

        $return = $table->getConnection()->transactional(
            function ($connection) use ($table, $records) {
                $order = $this->_config['start'];
                $field = $this->_config['order'];

                /** @var string $primaryKeyField */
                $primaryKeyField = $table->getPrimaryKey();
                foreach ($records as $record) {
                    if (is_scalar($record)) {
                        $record = [$primaryKeyField => $record];
                    }

                    if (is_array($record)) {
                        $record = $table->newEntity($record, [
                            'fields' => array_keys($record),
                            'validate' => false,
                            'accessibleFields' => [
                                $primaryKeyField => true,
                            ],
                        ]);
                        $record->isNew(false);
                        $record->setDirty($primaryKeyField, false);
                    }

                    $record->setAccess($field, true);
                    $record->set($field, $order++);

                    $r = $table->save(
                        $record,
                        ['atomic' => false, 'checkRules' => false]
                    );
                    if ($r === false) {
                        return false;
                    }
                }

                return true;
            }
        );

        $table->addBehavior('ADmad/Sequence.Sequence', $config);

        return $return;
    }