/// <summary>
 /// Finds and Return all DataItems for given DataTableRef within CompanyDataItemCollection
 /// </summary>
 /// <param name="DataTableRef"></param>
 /// <returns></returns>
 public CompanyDataItemCollection <T> Find(int dataTableRef)
 {
     if (this != null && dataTableRef != Null.Integer)
     {
         CompanyDataItemCollection <T> tempColl = new CompanyDataItemCollection <T>();
         foreach (T obj in this)
         {
             if (obj.DataTableRef == dataTableRef)
             {
                 tempColl.Add(obj);
             }
         }
         return(tempColl);
     }
     return(null);
 }
 /// <summary>
 /// Remove Duplicate DataItems (DataItemCode) within Collection
 /// </summary>
 /// <returns></returns>
 public CompanyDataItemCollection <T> RemoveDuplicateDataItems()
 {
     if (this != null || this.Count > 0)
     {
         CompanyDataItemCollection <T> distinctDataItemColl = new CompanyDataItemCollection <T>();
         foreach (T obj in this)
         {
             if (!distinctDataItemColl.Contains(obj.DataItemCode))
             {
                 distinctDataItemColl.Add(obj);
             }
         }
         return(distinctDataItemColl);
     }
     return(this);
 }
        /// <summary>
        /// Returns CompanyUnitDataTablesCollection for given CompanyRef
        /// </summary>
        public CompanyDataItemCollection <T> this[int CompanyRef]
        {
            get
            {
                if (CompanyRef != Null.Integer || !CompanyRef.Equals(null))
                {
                    CompanyDataItemCollection <T> tempColl = new CompanyDataItemCollection <T>();
                    foreach (T obj in this)
                    {
                        if (obj.CompanyUnitRef == CompanyRef)
                        {
                            tempColl.Add(obj);
                        }
                    }

                    return(tempColl);
                }
                return(null);
            }
        }