public function flush($dataset, $conditions = [])
    {
        // Handling conditions
        if (!is_array($conditions) && !is_object($conditions)) {
            $cond = [];

            foreach ((array) $this->getKeyName(true) as $field) {
                $cond[$field] = $conditions;
            }

            $conditions = $cond;
        }

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

        $result = $this->doFlush($dataset, (array) $conditions);

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

        return $result;
    }