public function insert($runValidation = true, $attributes = null)
    {
        $validationPromise = $runValidation
            ? new LazyPromise(function() use ($attributes) {
                return $this->validate($attributes);
            })
            : Reaction\Promise\resolveLazy(true);
        return $validationPromise
            ->otherwiseLazy(function() {
                Reaction::info('Model not inserted due to validation error in {method}.', ['method' => __METHOD__]);
                return reject(new ValidationError("Model validation error"));
            })->thenLazy(function() use ($attributes) {
                if (!$this->isTransactional(self::OP_INSERT)) {
                    return new LazyPromise(function() use ($attributes) {
                        return $this->insertInternal($attributes);
                    });
                }

                $transaction = static::getDb()->createTransaction();
                return $transaction->begin()->then(
                    function(ConnectionInterface $connection) use ($attributes) {
                        return $this->insertInternal($attributes, $connection);
                    }
                )->then(
                    function($result) use ($transaction) {
                        return $transaction->commit()->then(function() use ($result) {
                            return $result;
                        });
                    },
                    function($exception) use ($transaction) {
                        return $transaction->rollBack()->then(
                            function() use ($exception) { throw $exception; },
                            function($e) use ($exception) { throw $exception; }
                        );
                    }
                );
            });
    }