title: I need to add a collection value to database . Which is the efficient way to do it?
body: <ol>
  <li>Do I need to pass a class objects to the Model method and process it one at a time?</li>
  </ol>
  
  <p>Eg. </p>
  
  <pre><code>public async Task&lt;int&gt; SaveCollectionValues(Foo foo)
  {
     ....
     //Parameters
     MySqlParameter prmID = new MySqlParameter("pID", MySqlDbType.Int32);
     prmID.Value = foo.ID;
     sqlCommand.Parameters.Add(prmID);
  
     ....
  }
  
  
  (OR)
  </code></pre>
  
  <p>2. Shall I pass the Collection value to the Model method and use foreach to iterate through the collection</p>
  
  <pre><code>public async Task&lt;int&gt; SaveCollectionValues(FooCollection foo)
  {
     ....
  
     //Parameters
     foreach(Foo obj in foo)
     {
     MySqlParameter prmID = new MySqlParameter("pID", MySqlDbType.Int32);
     prmID.Value = foo.ID;
     sqlCommand.Parameters.Add(prmID);
  
     ....
     }
     ....
  }
  </code></pre>
  
  <p>I just need to know which of the above mentioned method would be efficient to use?</p>