public async Task <IActionResult> PostStockItemAsync([FromBody] PostStockItemsRequest request)
        {
            Logger?.LogDebug("'{0}' has ben invoked", nameof(PostStockItemAsync));
            var response = new SingleResponse <StockItem>();

            try
            {
                var existingEntity = await webAPIContext.GetStockItemsByStockItemNameAsync(new StockItem { StockItemName = request.StockItemName });

                if (existingEntity != null)
                {
                    ModelState.AddModelError("StockItemName", "Stock item name already exists");
                }
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }


                var entiry = request.ToEntity();
                webAPIContext.Add(entiry);
                webAPIContext.SaveChangesAsync();
                response.Model = entiry;
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = "There was an internal error, please contact to technical support.";
                Logger?.LogCritical("There was an error on '{0}' invocation: {1}", nameof(PostStockItemAsync), ex);
            }
            return(response.toHttpResponse());
        }
        public async Task <IActionResult> GetStockItemAsync(int id)
        {
            Logger?.LogDebug("'{0}' has been invoked", nameof(GetStockItemAsync));
            var response = new SingleResponse <StockItem>();

            try
            {
                // Get the stock item by id
                response.Model = await webAPIContext.GetStockItemsAsync(new StockItem(id));
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = "There was an internal error, please contact to technical support.";

                Logger?.LogCritical("There was an error on '{0}' invocation: {1}", nameof(GetStockItemAsync), ex);
            }

            return(response.toHttpResponse());
        }