public function removePeriod(Period $period) { if ($this->periods->contains($period)) { $this->periods->removeElement($period); } }