public async Task <ActionResultResponse> Insert(string tenantId, ProductCategoriesAttributeMeta productCategoriesAttributeMeta) { var lstproductCategoriesAttributes = new List <ProductCategoriesAttribute>(); foreach (var item in productCategoriesAttributeMeta.ProductCategoriesAttributes) { if (!(await _productCategoryRepository.CheckExists(tenantId, item.CategoryId))) { return(new ActionResultResponse(-1, _resourceService.GetString("Category not exists"))); } if (!(await _attributeRepository.CheckExists(item.AttributeId, tenantId))) { return(new ActionResultResponse(-1, _resourceService.GetString("Attribute not exists"))); } if (!(await _productCategoriesAttributeRepository.CheckExistsById(item.CategoryId, item.AttributeId))) { lstproductCategoriesAttributes.Add(new ProductCategoriesAttribute() { CategoryId = item.CategoryId, AttributeId = item.AttributeId, }); } } var result = await _productCategoriesAttributeRepository.Inserts(lstproductCategoriesAttributes); if (result <= 0) { return(new ActionResultResponse(result, _sharedResourceService.GetString("Something went wrong. Please contact with administrator."))); } return(new ActionResultResponse(1, _resourceService.GetString("Add new ProductCategoriesAttribute successful"))); }