I passed an array of object key-value pairs from the frontend to the controller. refer here for clarification [Pass array of objects to asp.net core controller via ajax](https://stackoverflow.com/questions/67870420/how-to-pass-array-of-objects-to-asp-net-core-controller-via-ajax/67871285#67871285)

The list is going to different tables, I want to loop the list and check those that start with "product" and save to the Product table, then those start with "fee" to Fee table etc.

I am thinking of putting it in a dictionary to get the keys and the values, with that I can assign each value to Project object and Fee object.

[![enter image description here](https://i.stack.imgur.com/llTVm.png)](https://i.stack.imgur.com/llTVm.png)

```
        public ActionResult CreateSetUp(List<MerchantInfoSetUpViewModel> collection)
        {
            try
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    var eachName = collection[i].Name; 
                    if (eachName.Substring(0, 7) == "product")
                    {                        
                        //List<string> allValues = (from productFeeValue in collection select productFeeValue.Value).Distinct().ToList();                        //List<string> keyList = new List<string>(this.co)
                        ConfigureMerchantFee configureMerchantFee = new ConfigureMerchantFee
                        {        
                            //MerchantId = allValues.                       
                        };
                        productRepository.AddOneEntity(collection[i].Value);
                    }
                    if (eachName.Substring(0, 8) == "product-")
                    {
                    } 
                    else { }              
                }                

                return RedirectToAction(nameof(Index));            
            }catch{                
                return null;            
            }        
        }

```