It would be good to return the event ID for saving - this helps with matching updates and deletes with the right event later.

At line 661 replace these two lines:

  if ($result['status'] == '201')
    return TRUE;

With these:

  if ($result['status'] == '201') {
    $content=simplexml_load_string(str_replace("\n", '', $result['content']));
    $newid=$content->id;
    return $newid;
  }