public function BuildReservation()
 {
     $userId = $this->_page->GetUserId();
     $primaryResourceId = $this->_page->GetResourceId();
     $resource = $this->_resourceRepository->LoadById($primaryResourceId);
     $title = $this->_page->GetTitle();
     $description = $this->_page->GetDescription();
     $roFactory = new RepeatOptionsFactory();
     $repeatOptions = $roFactory->CreateFromComposite($this->_page, $this->userSession->Timezone);
     $duration = $this->GetReservationDuration();
     /*EXPERIMENT*/
     $experiment = $this->_page->getExperiment();
     $reservationSeries = ReservationSeries::Create($userId, $resource, $title, $description, $duration, $repeatOptions, $this->userSession, $experiment);
     $resourceIds = $this->_page->GetResources();
     foreach ($resourceIds as $resourceId) {
         if ($primaryResourceId != $resourceId) {
             $reservationSeries->AddResource($this->_resourceRepository->LoadById($resourceId));
         }
     }
     $accessories = $this->_page->GetAccessories();
     foreach ($accessories as $accessory) {
         $reservationSeries->AddAccessory(new ReservationAccessory($accessory->Id, $accessory->Quantity, $accessory->Name));
     }
     $attributes = $this->_page->GetAttributes();
     foreach ($attributes as $attribute) {
         $reservationSeries->AddAttributeValue(new AttributeValue($attribute->Id, $attribute->Value));
     }
     $participantIds = $this->_page->GetParticipants();
     $reservationSeries->ChangeParticipants($participantIds);
     $inviteeIds = $this->_page->GetInvitees();
     $reservationSeries->ChangeInvitees($inviteeIds);
     $reservationSeries->AllowParticipation($this->_page->GetAllowParticipation());
     $attachments = $this->_page->GetAttachments();
     foreach ($attachments as $attachment) {
         if ($attachment != null) {
             if ($attachment->IsError()) {
                 Log::Error('Error attaching file %s. %s', $attachment->OriginalName(), $attachment->Error());
             } else {
                 $att = ReservationAttachment::Create($attachment->OriginalName(), $attachment->MimeType(), $attachment->Size(), $attachment->Contents(), $attachment->Extension(), 0);
                 $reservationSeries->AddAttachment($att);
             }
         }
     }
     if ($this->_page->HasStartReminder()) {
         $reservationSeries->AddStartReminder(new ReservationReminder($this->_page->GetStartReminderValue(), $this->_page->GetStartReminderInterval()));
     }
     if ($this->_page->HasEndReminder()) {
         $reservationSeries->AddEndReminder(new ReservationReminder($this->_page->GetEndReminderValue(), $this->_page->GetEndReminderInterval()));
     }
     return $reservationSeries;
 }