/**
  * Converts SimpleXMLElement to an array
  */
 static function simpleXmlToArray(SimpleXMLElement &$source)
 {
     $res = array();
     $children = false;
     foreach ($source as $key => $value) {
         CPS_Response::simpleXmlToArrayHelper($res, $key, $value, $children);
     }
     if ($source) {
         foreach ($source->children('www.clusterpoint.com') as $key => $value) {
             $newkey = 'cps:' . $key;
             CPS_Response::simpleXmlToArrayHelper($res, $newkey, $value, $children);
         }
     }
     if (!$children) {
         return (string) $source;
     }
     return $res;
 }