public function insert()
{
if (!empty($this->timestamps) && in_array("createdAt", $this->timestamps)) {
$this->createdAt = date("Y-m-d H:i:s");
}
$sqlData = $this->prepareData();
if (!$this->validate($sqlData)) {
return false;
}
$id = $this->db->insert($this->dbTable, $sqlData);
if (!empty($this->primaryKey) && empty($this->data[$this->primaryKey])) {
$this->data[$this->primaryKey] = $id;
}
$this->isNew = false;
return $id;
}