public async Task <OrderDiscount> GetRawByCodeAsync(string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                return(null);
            }

            var discount = await orderDiscountRepository
                           .GetByCodeAsync(code);

            if (discount == null)
            {
                throw new StreetwoodException(ErrorCode.GenericNotExist(typeof(OrderDiscount)));
            }

            return(discount);
        }
        public async Task AddAsync(string name, string nameEng, string description, string descriptionEng, int percentValue,
                                   DateTime availableFrom, DateTime availableTo, string code)
        {
            var existingDiscount = await orderDiscountRepository.GetByCodeAsync(code);

            if (existingDiscount != null)
            {
                throw new StreetwoodException(ErrorCode.DiscountWithThisCodeExistAlready);
            }

            var discount = new OrderDiscount(name, nameEng, description, descriptionEng, percentValue,
                                             availableFrom, availableTo, code);

            await orderDiscountRepository.AddAsync(discount);

            await orderDiscountRepository.SaveChangesAsync();
        }