public function save(Feeding $feeding) { if ($feeding instanceof NullFeeding) { throw new Exception('You cannot save NullFeeding'); } if ($feeding->hasId()) { $this->update($feeding); } else { $this->insert($feeding); } }