public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType)
    {
        $result = $BagValue->results;

        $propertyContent = new ODataPropertyContent();
        $odataProperty = new ODataProperty();
        $odataProperty->name = $propertyName;
        $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() . ')';
        $odataProperty->value = $this->writeBagValue($resourceType, $result);

        $propertyContent->properties[$propertyName] = $odataProperty;
        return $propertyContent;
    }