/// <summary>
 /// Create a new TpMetaData object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="hostCountryId">Initial value of the HostCountryId property.</param>
 public static TpMetaData CreateTpMetaData(global::System.Int32 id, global::System.Int32 hostCountryId)
 {
     TpMetaData tpMetaData = new TpMetaData();
     tpMetaData.Id = id;
     tpMetaData.HostCountryId = hostCountryId;
     return tpMetaData;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the TpMetaDatas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTpMetaDatas(TpMetaData tpMetaData)
 {
     base.AddObject("TpMetaDatas", tpMetaData);
 }
 private IEnumerable<PublisherStatus> PublishMetaData(DataRowCollection metaDataRows, string sheetName)
 {
     var allStatus = new List<PublisherStatus>();
     using (var work = new UnitOfWork())
     {
         var tpTreatyMetaDataRepo = RepositoryContainer.GetRepository<Nest.DataAccess.TpMetaData>(work);
         if(HostCountry != null)
         {
             if (metaDataRows.Count > 1)
             {
                 tpTreatyMetaDataRepo.Delete(b => b.HostCountryId == HostCountry.Id);
                 for (var index = 1; index < metaDataRows.Count; index++)
                 {
                     var tpMetaData = new Nest.DataAccess.TpMetaData()
                                          {
                                              Title = metaDataRows[index].ItemArray[0].ToString().Trim().Length > 1 ? metaDataRows[index].ItemArray[0].ToString().Trim() : null,
                                              HostCountryId = HostCountry.Id,
                                              MetaData = metaDataRows[index].ItemArray[1].ToString().Trim().Length > 1 ? metaDataRows[index].ItemArray[1].ToString().Trim() : null
                                          };
                     tpTreatyMetaDataRepo.Add(tpMetaData);
                 }
                 work.SaveChanges();
                 allStatus.Add(new PublisherStatus() { Message = "Data uploaded sucessfully for sheet " + sheetName, Status = true });
             }
         }
     }
     return allStatus;
 }