public function save($dataset, $condFields = null, $updateNulls = false)
    {
        // Handling conditions
        $condFields = $condFields ?: $this->getKeyName(true);

        $condFields = (array) $condFields;

        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'dataset' => &$dataset,
                'condFields' => &$condFields,
                'updateNulls' => &$updateNulls,
            ]
        );

        $datasetClass = $this->datasetClass;

        $createDataset = new $datasetClass();
        $updateDataset = new $datasetClass();

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

            $update = true;

            // If AI field is empty, use insert.
            foreach ($condFields as $field) {
                $extra = $fields[$field]->Extra ?? '';

                if ($extra === 'auto_increment' && !$data->$field) {
                    $update = false;

                    break;
                }
            }

            // Do save
            if ($update) {
                $updateDataset[] = $data;
            } else {
                $createDataset[] = $data;
            }

            $dataset[$k] = $data;
        }

        $this->create($createDataset);

        $this->update($updateDataset, $condFields, $updateNulls);

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$dataset,
            ]
        );

        return $dataset;
    }