/**
  *
  * @param string $scope
  * @param int $scopeId
  * @param int $parentId
  */
 protected function savePaymentConfigs($scope = 'websites', $scopeId, $parentId = 0)
 {
     $parentField = 'parent_default_id';
     $parentScope = 'default';
     if ($scope == 'stores') {
         $parentField = 'parent_websites_id';
         $parentScope = 'websites';
     }
     /** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
     $collection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
     $collection->addFieldToFilter('scope', $parentScope);
     $collection->addFieldToFilter('scope_id', $parentId);
     // @todo hs: include deleted configs?
     foreach ($collection->getItems() as $parentConfig) {
         $childPaymentConfig = new Payone_Core_Model_Domain_Config_PaymentMethod();
         $childPaymentConfig->setScope($scope);
         $childPaymentConfig->setScopeId($scopeId);
         $childPaymentConfig->setCode($parentConfig->getCode());
         $childPaymentConfig->setData($parentField, $parentConfig->getId());
         $childPaymentConfig->save();
     }
 }
 /**
  * @param Payone_Core_Model_Domain_Config_PaymentMethod $child
  * @param Payone_Core_Model_Domain_Config_PaymentMethod $parent
  * @return Payone_Core_Model_Domain_Config_PaymentMethod
  */
 protected function mergeData(Payone_Core_Model_Domain_Config_PaymentMethod $child, Payone_Core_Model_Domain_Config_PaymentMethod $parent)
 {
     foreach ($child->getData() as $key => $value) {
         if ($value === null || $value === false) {
             $child->setData($key, $parent->getData($key));
         }
     }
     return $child;
 }