private function insertModelIntoDatabase(ModelInterface $model, $timestamp = 0)
    {
        $data = $this->convertModelToDataPropertyArray($model, $timestamp);
        if ($this->getIdGenerator()) {
            $model->setId($this->getIdGenerator()->generate());
            $data[$this->idProperty] = $model->getId();
        }

        $this->connection->insert($this->source, $data);

        $insertId = $this->connection->lastInsertId($this->source);

        if (('' !== $insertId) && !isset($data[$this->idProperty])) {
            $model->setId($insertId);
        }
    }