/// <summary>
        /// Method to add a stock Item
        /// </summary>
        /// <param name="userName">UserCode</param>
        /// <param name="stockItem">Stock Item</param>
        /// <param name="taxCodes">List of tax codes</param>
        /// <param name="error">Error message</param>
        public void AddStockItem(string userName, StockItem stockItem, List <string> taxCodes, out ErrorMessage error)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug($"Start,StockManager,AddStockItem,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");
            var offSet = _policyManager.LoadStoreInfo().OffSet;

            error = new ErrorMessage();
            if (!string.IsNullOrEmpty(userName) && _loginManager.GetUser(userName) != null)
            {
                //var user = _userService.GetUser(userName);
                var user = _loginManager.GetUser(userName);

                var stockCode   = stockItem.StockCode;
                var canAddStock = _policyManager.GetPol("U_AddStock", user);
                if (!Convert.ToBoolean(canAddStock))
                {
                    error.MessageStyle = _resourceManager.CreateMessage(offSet, 39, 91, stockCode, (MessageType)((int)MessageType.Critical + (int)MessageType.OkOnly));
                    error.StatusCode   = HttpStatusCode.NotFound;
                    return;
                }
                if (string.IsNullOrEmpty(stockCode))
                {
                    error.MessageStyle = new MessageStyle
                    {
                        Message     = "Stock code is required",
                        MessageType = MessageType.OkOnly
                    };
                    error.StatusCode = HttpStatusCode.NotAcceptable;
                    return;
                }
                if (string.IsNullOrEmpty(stockItem.Description))
                {
                    error.MessageStyle = new MessageStyle
                    {
                        Message     = "Description is required",
                        MessageType = MessageType.OkOnly
                    };
                    error.StatusCode = HttpStatusCode.NotAcceptable;
                    return;
                }
                if (Conversion.Val(stockItem.Price) <= 0)
                {
                    error.MessageStyle = new MessageStyle
                    {
                        Message     = "Price should be more than 0",
                        MessageType = MessageType.OkOnly
                    };
                    error.StatusCode = HttpStatusCode.NotAcceptable;
                    return;
                }
                if (SetupTaxes(taxCodes, stockCode) == false)
                {
                    error.MessageStyle = _resourceManager.CreateMessage(offSet, 39, 96, stockCode, (MessageType)((int)MessageType.Critical + (int)MessageType.OkOnly));
                    error.StatusCode   = HttpStatusCode.Conflict;
                    return;
                }
                if (_stockService.GetStockItemByCode(stockCode, true) != null)
                {
                    error.MessageStyle = _resourceManager.CreateMessage(offSet, 39, 95, stockCode, (MessageType)((int)MessageType.Critical + (int)MessageType.OkOnly));
                    error.StatusCode   = HttpStatusCode.Conflict;
                    return;
                }
                if (_stockService.GetPluMast(stockCode) != null)
                {
                    error.MessageStyle = _resourceManager.CreateMessage(offSet, 39, 95, stockCode, (MessageType)((int)MessageType.Critical + (int)MessageType.OkOnly));
                    error.StatusCode   = HttpStatusCode.Conflict;
                    return;
                }
                _stockService.AddStockItem(stockItem, _policyManager.ELG_LOY);
                _stockService.AddPluMast(stockCode);
                _stockService.AddStockBranch(stockCode);
                _stockService.AddStockPrice(stockCode, stockItem.Price);
            }
            else
            {
                error.MessageStyle = _resourceManager.CreateMessage(offSet, 10, 95, userName, (MessageType)((int)MessageType.Critical + (int)MessageType.OkOnly));
                error.StatusCode   = HttpStatusCode.Unauthorized;
            }

            Performancelog.Debug($"End,StockManager,AddStockItem,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");
        }