code: public function save(JobEntity $job)
  	{
  		$query = null;
  
  		if ((int) $job->getId() == 0) {
  			$query = $this->sql->insert();
  			$query->values($job->getArrayCopy());
  		} else {
  			$query = $this->sql->update();
  			$query->set($job->getArrayCopy());
  			$query->where(array('id' => $job->getId()));
  		}
  
  		$stmt = $this->sql->prepareStatementForSqlObject($query);
  		$res = $stmt->execute();
  
  		if ((int) $job->getId() == 0) {
  			$job->setId((int) $res->getGeneratedValue());
  		}
  
  		return $job;
  	}
docs: Save job.
  
  @param JobEntity $job
  @return JobEntity