public function save()
{
$version = get_object_vars($this->model);
foreach ($version as $key => $value) {
if (in_array($key, $this->getValidTableColumns("versions"))) {
if (is_bool($value)) {
$value = (int) $value;
}
$data[$key] = $value;
}
}
$this->db->insertOrUpdate("versions", $data);
$lastInsertId = $this->db->lastInsertId();
if (!$this->model->getId() && $lastInsertId) {
$this->model->setId($lastInsertId);
}
return $this->model->getId();
}