protected function doCreate($dataset)
    {
        !$this->useTransaction ?: $this->db->getTransaction(true)->start();

        try {
            $pkName = $this->getKeyName();

            foreach ($dataset as $k => $data) {
                if (!($data instanceof $this->dataClass)) {
                    $data = $this->bindData($data);
                }

                // If data is entity object, try cast values first.
                if ($data instanceof Entity) {
                    $data = $this->castForStore($data);
                }

                $fields = $this->getFields($this->table, false);

                if (!$data->$pkName) {
                    unset($fields[$pkName]);
                }

                // Then recreate a new Entity to force fields limit.
                $entity = new Entity($fields, $data);

                $entity = $this->validValue($entity);

                $this->db->getWriter()->insertOne($this->table, $entity, $pkName, $entity->hasIncrementField());

                $data->$pkName = $entity->$pkName;

                $dataset[$k] = $data;
            }
        } catch (\Throwable $e) {
            !$this->useTransaction ?: $this->db->getTransaction(true)->rollback();

            throw $e;
        }

        !$this->useTransaction ?: $this->db->getTransaction(true)->commit();

        return $dataset;
    }