/// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(SalesRebateProductViewModel model)
        {
            var entity = model.ToEntity();
            this._SalesRebateProductsRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
        /// <summary>
        /// Throw an exception if name is exist.
        /// </summary>
        /// <param name="model">SalesRebateProduct view model</param>
        public void ThrowExceptionIfExist(SalesRebateProductViewModel model)
        {
            ConditionFilter<SalesRebateProduct, long> condition = new ConditionFilter<SalesRebateProduct, long>
            {
                Query = (entity =>
                    entity.Name == model.Name &&
                    entity.Id != model.Id)
            };
            var existEntity = this._SalesRebateProductsRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
                throw new ItemAlreadyExistException();
        }
        /// <summary>
        /// Add an entity.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public SalesRebateProductViewModel Add(SalesRebateProductViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();
            entity = this._SalesRebateProductsRepository.Add(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return model;
        }