protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null)
{
if (!$existingObject) {
// This is a new invite, and we're just going to copy over
// all the components from the invite.
$existingObject = new VCalendar();
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
} else {
// We need to update an existing object with all the new
// information. We can just remove all existing components
// and create new ones.
foreach ($existingObject->getComponents() as $component) {
$existingObject->remove($component);
}
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
}
return $existingObject;
}