 <pre><code>EducList = new ObservableCollection&lt;tblGALContinuingEducationHistory&gt;(currentGal.tblGALContinuingEducationHistories.Count &gt; 0 &amp;&amp; currentGal.tblGALContinuingEducationHistories != null ? currentGal.tblGALContinuingEducationHistories : null); int count = 0; //5 is the maximum no of course an atty can take and save in this form count = 5 - EducList.Count; for (int i = 0; i &lt; count; i++) { galContEdu = FileMaintenanceBusiness.Instance.Create&lt;tblGALContinuingEducationHistory&gt;(); galContEdu.AttorneyID = currentGal.AttorneyID; EducList.Add(galContEdu); } </code></pre> <p>then save only the ones that has data:</p> <pre><code>foreach (var item in EducList) { if(!string.IsNullOrEmpty(item.CourseTitle) || !string.IsNullOrWhiteSpace(item.CourseTitle)) FileMaintenanceBusiness.Instance.SaveChanges(item, true); } </code></pre>