/**
  * Write value of a complex object.
  * Note: This method will not handle null complex value.
  *
  * @param mixed                &$complexValue         Complex object to write.
  * @param string               $propertyName          Name of the
  *                                                    complex property
  *                                                    whose value
  *                                                    need to be written.
  * @param ResourceType         &$resourceType         Expected type of the
  *                                                    property.
  * @param string               $relativeUri           Relative uri for the
  *                                                    complex type element.
  * @param ODataPropertyContent &$odataPropertyContent Content to write to.
  *
  * @return ResourceType The actual type of the complex object.
  *
  * @return void
  */
 private function _complexObjectToContent(&$complexValue, $propertyName, ResourceType &$resourceType, $relativeUri, ODataPropertyContent &$odataPropertyContent)
 {
     $count = count($this->complexTypeInstanceCollection);
     for ($i = 0; $i < $count; $i++) {
         if ($this->complexTypeInstanceCollection[$i] === $complexValue) {
             throw new InvalidOperationException(Messages::objectModelSerializerLoopsNotAllowedInComplexTypes($propertyName));
         }
     }
     $this->complexTypeInstanceCollection[$count] =& $complexValue;
     //TODO function to resolve actual type from $resourceType
     $actualType = $resourceType;
     $odataEntry = null;
     $this->_writeObjectProperties($complexValue, $actualType, null, $relativeUri, $odataEntry, $odataPropertyContent);
     unset($this->complexTypeInstanceCollection[$count]);
     return $actualType;
 }