private async Task <int> DeleteWooAttribute(WooProductMap deleteWooProductMap)
        {
            int _result = AppUnitOfWork.CONST_WASERROR;  // if all goes well this will be change to the number of records returned

            IWooProduct _wooProductRepository = await GetIWooProduct();

            if (_wooProductRepository != null)
            {
                Product _TempWooCat = await _wooProductRepository.DeleteProductByIdAsync(deleteWooProductMap.WooProductId);

                _result = (_TempWooCat == null) ? AppUnitOfWork.CONST_WASERROR : Convert.ToInt32(_TempWooCat.id);  // return the id
            }
            return(_result);
        }
        private async Task <Product> AddItemToWooOnlySync(Item addEntity)
        {
            IWooProduct _wooProductRepository = await GetIWooProduct();

            if (_wooProductRepository == null)
            {
                return(null);
            }

            Product _wooProduct = new Product
            {
                name = addEntity.ItemName,
                //order_by = ConvertToWooOrderBy(addEntity.OrderBy),
            };

            return(await _wooProductRepository.AddProductAsync(_wooProduct));  // should return a new version with ID
        }
        public override async Task <int> UpdateWooItemAsync(ItemView updateViewEntity)
        {
            int _result = 0;  /// null or not found

            if ((updateViewEntity.HasWooAttributeMap) && ((bool)(updateViewEntity.CanUpdateWooMap)))
            {
                IWooProduct _wooProductRepository = await GetIWooProduct();

                if (_wooProductRepository != null)                     //  - > if it does not exist then what?
                {
                    WooProductMap _updateWooMapEntity = await GetWooProductMapFromID(updateViewEntity.ItemId);

                    if (_updateWooMapEntity == null)
                    {
                        // need to add the Attribute -> this is done later.
                        _result = await AddWooItemAndMapAsync(updateViewEntity);
                    }
                    else
                    {
                        Product _wooProduct = await _wooProductRepository.GetProductByIdAsync(_updateWooMapEntity.WooProductId);

                        if (_wooProduct == null)
                        {
                            return(AppUnitOfWork.CONST_WASERROR);  /// oops what happened >?
                        }
                        else
                        {
                            // only update if different
                            if ((!_wooProduct.name.Equals(updateViewEntity.ItemName))) //|| (!_wooProduct.order_by.Equals(updateViewEntity.OrderBy.ToString(), StringComparison.OrdinalIgnoreCase)))
                            {
                                _wooProduct.name = updateViewEntity.ItemName;          // only update if necessary
                                //_wooProduct.order_by = ConvertToWooOrderBy(updateViewEntity.OrderBy);
                                var _res = ((await _wooProductRepository.UpdateProductAsync(_wooProduct)));
                                _result = ((_res == null) || (_res.id == null)) ? AppUnitOfWork.CONST_WASERROR : (int)_res.id; // if null there is an issue
                            }
                        }
                    }
                }
            }
            return(_result);
        }