/**
  * @param ReservationListItem $item
  * @return SchedulePeriod which has the closest starting time to $endingTime without going prior to it
  */
 private function FindClosestLayoutIndexBeforeStartingTime(ReservationListItem $item)
 {
     for ($i = count($this->_layoutItems) - 1; $i >= 0; $i--) {
         $currentItem = $this->_layoutItems[$i];
         if ($currentItem->BeginDate()->LessThan($item->StartDate())) {
             return $currentItem;
         }
     }
     Log::Error('Could not find a fitting starting slot for reservation. Id %s, ResourceId: %s, Start: %s, End: %s', $item->Id(), $item->ResourceId(), $item->StartDate()->ToString(), $item->EndDate()->ToString());
     return null;
 }