public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
if ($this
->getJobId()) {
$this
->recalculateStatistics();
drupal_static_reset('tmgmt_job_statistics_load');
}
if ($this->unserializedData) {
$this->data = Json::encode($this->unserializedData);
}
elseif (empty($this
->get('data')->value)) {
$this->data = Json::encode(array());
}
}