protected function initializeProductMediaGallery(array $attr)
    {

        // load the value and the attribute ID
        $value = $attr[MemberNames::VALUE];
        $attributeId = $attr[MemberNames::ATTRIBUTE_ID];

        // query whether the product media gallery entity already exists or not
        if ($entity = $this->loadProductMediaGallery($attributeId, $value)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }