This sort of logic probably belongs in the model rather than the controller. It'd be nice to have a getProject() in JobRecord that does this. We should also make the id null rather than zero when there is no project associated with the job.