public function save(array $data = [], array $params = [], array $where = [])
    {
        if (empty($where)) {
            return $this
                ->createQuery(
                    $this->getQueryBuilder()
                        ->insert(array() === $data ? $this->data : $data)
                        ->from($this->getTable())
                )
                ->setParameter([] === $params ? $this->params : $params)
                ->execute()
                ->getId();
        }

        return $this
            ->createQuery(
                $this
                    ->getQueryBuilder()
                    ->update(array() === $data ? $this->data : $data)
                    ->from($this->getTable())
                    ->where($where)
            )
            ->setParameter([] === $params ? $this->params : $params)
            ->execute()
            ->getAffected()
            ;
    }