private function readSnapshotEventEntry()
 {
     $snapshotEventReader = new FilesystemEventMessageReader($this->snapshotEventFile, $this->eventSerializer);
     $bytesToSkip = $this->readLong($this->snapshotEventFile);
     $snapshotEvent = $snapshotEventReader->readEventMessage();
     if (null === $bytesToSkip && null === $snapshotEvent) {
         return array();
     }
     return array('snapshotEvent' => $snapshotEvent, 'bytesToSkip' => $bytesToSkip);
 }
 /**
  * Calculate the bytes to skip when reading the event file.
  *
  * @param DomainEventMessageInterface $snapshotEvent the snapshot event
  * @return integer the bytes to skip when reading the event file
  *
  * @throws \Exception
  */
 private function calculateOffset(DomainEventMessageInterface $snapshotEvent)
 {
     try {
         $eventMessageReader = new FilesystemEventMessageReader($this->eventFile, $this->eventSerializer);
         $lastReadSequenceNumber = -1;
         while ($lastReadSequenceNumber < $snapshotEvent->getScn()) {
             $entry = $eventMessageReader->readEventMessage();
             $lastReadSequenceNumber = $entry->getScn();
         }
         return $this->eventFile->ftell();
     } catch (\Exception $ex) {
         throw $ex;
     }
 }