/**
  * Push a content changeset to a syncro node
  * 
  * @param ContentChangeset $changeset
  * @param RemoteSyncroNode $node
  * 
  */
 public function pushChangeset($changeset, $node)
 {
     $cs = $changeset->ChangesetItems();
     $update = array('changes' => array(), 'deletes' => array(), 'rels' => array());
     foreach ($cs as $changesetItem) {
         $record = null;
         // if it's a delete, we create a syncro delete, otherwise get the versioned item
         if ($changesetItem->ChangeType == 'Draft Deleted') {
             // find the syncrodelete record
             $record = DataList::create('SyncroDelete')->filter(array('ContentID' => $changesetItem->OtherContentID))->first();
             $del = array('SYNCRODELETE' => 'DELETE', 'ContentID' => $record->ContentID, 'Type' => $record->Type, 'MasterNode' => SiteConfig::current_site_config()->SystemID, 'Deleted' => $record->Created);
             $update['deletes'][] = $del;
         } else {
             $record = Versioned::get_version($changesetItem->OtherClass, $changesetItem->OtherID, $changesetItem->ContentVersion);
             $syncd = $this->syncroObject($record);
             $syncd['ClassName'] = $record->ClassName;
             if (count($syncd['has_one']) || count($syncd['many_many'])) {
                 $relInfo = new stdClass();
                 $relInfo->SYNCROREL = true;
                 $relInfo->Type = $record->ClassName;
                 $relInfo->ContentID = $record->ContentID;
                 $relInfo->MasterNode = SiteConfig::current_site_config()->SystemID;
                 $relInfo->has_one = $syncd['has_one'];
                 $relInfo->many_many = $syncd['many_many'];
                 $update['rels'][] = $relInfo;
             }
             unset($syncd['has_one']);
             unset($syncd['many_many']);
             $update['changes'][] = $syncd;
         }
     }
     if ($update && $node) {
         $url = $node->NodeURL;
         $service = new RestfulService($url, -1);
         $params = array('changes' => $update['changes'], 'deletes' => $update['deletes'], 'rels' => $update['rels']);
         $headers = array('X-Auth-Token: ' . $node->APIToken, 'Content-Type: application/json');
         $body = json_encode($params);
         $response = $service->request(self::PUSH_URL, 'POST', $body, $headers);
         //, $headers, $curlOptions);
         if ($response && $response->isError()) {
             $body = $response->getBody();
             if ($body) {
                 $this->log->logError($body);
             }
             return array(false, "Deployment failed to {$url}: status {$response->getStatusCode()}");
         }
         $body = $response->getBody();
         if ($body) {
             return array(true, 'Deployment successful');
         }
     }
 }