public function save()
{
$ts = time();
if (!$this->model->getCreationDate()) {
$this->model->setCreationDate($ts);
}
$this->model->setModificationDate($ts);
try {
$dataRaw = get_object_vars($this->model);
$data = [];
$allowedProperties = ["name", "description", "items", "medias", "format", "quality", "highResolution", "creationDate", "modificationDate", "preserveColor", "preserveMetaData"];
foreach ($dataRaw as $key => $value) {
if (in_array($key, $allowedProperties)) {
$data[$key] = $value;
}
}
$this->db->insertOrUpdate($data, $this->model->getName());
} catch (\Exception $e) {
throw $e;
}
}