/// <summary>
        /// Creates the payment method country mapping
        /// </summary>
        /// <param name="paymentMethodId">The payment method identifier</param>
        /// <param name="countryId">The country identifier</param>
        public void CreatePaymentMethodCountryMapping(int paymentMethodId, int countryId)
        {
            var paymentMethod = GetPaymentMethodById(paymentMethodId);

            if (paymentMethod == null)
            {
                return;
            }

            var country = IoC.Resolve <ICountryService>().GetCountryById(countryId);

            if (country == null)
            {
                return;
            }

            if (!_context.IsAttached(paymentMethod))
            {
                _context.PaymentMethods.Attach(paymentMethod);
            }
            if (!_context.IsAttached(country))
            {
                _context.Countries.Attach(country);
            }

            //ensure that navigation property is loaded
            if (country.NpRestrictedPaymentMethods == null)
            {
                _context.LoadProperty(country, c => c.NpRestrictedPaymentMethods);
            }

            country.NpRestrictedPaymentMethods.Add(paymentMethod);
            _context.SaveChanges();
        }
        /// <summary>
        /// Adds a discount to a product variant
        /// </summary>
        /// <param name="productVariantId">Product variant identifier</param>
        /// <param name="discountId">Discount identifier</param>
        public void AddDiscountToProductVariant(int productVariantId, int discountId)
        {
            var productVariant = IoC.Resolve <IProductService>().GetProductVariantById(productVariantId);

            if (productVariant == null)
            {
                return;
            }

            var discount = GetDiscountById(discountId);

            if (discount == null)
            {
                return;
            }


            if (!_context.IsAttached(productVariant))
            {
                _context.ProductVariants.Attach(productVariant);
            }
            if (!_context.IsAttached(discount))
            {
                _context.Discounts.Attach(discount);
            }

            //ensure that navigation property is loaded
            if (productVariant.NpDiscounts == null)
            {
                _context.LoadProperty(productVariant, pv => pv.NpDiscounts);
            }

            productVariant.NpDiscounts.Add(discount);
            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(DISCOUNTS_PATTERN_KEY);
            }
        }