public function sync() { if ($this->_debug) { echo "Sync of reservation #{$this->_reservation->getId()}" . PHP_EOL; } if (!$this->isValid()) { if ($this->_debug) { echo 'Something wrong with calendar. Stop' . PHP_EOL; } return false; } if ($this->_reservation->isAccepted()) { if ($this->_reservation->wasSynced()) { $this->_sync(); } else { $this->_addRemote(); } } else { if ($this->_reservation->isDeclined()) { if ($this->_reservation->wasSynced()) { $this->deleteRemote(); // delete remove first because delete remove method removes Google Event Id !! $this->_deleteLocal(); } } } return true; }