private static void PersistPortalChannel(PortalChannel pChannel)
 {
   TvBusinessLayer layer = new TvBusinessLayer();
   Channel dbPortalChannel = layer.GetChannelByTuningDetail(pChannel.NetworkId, pChannel.TransportId,
                                                            pChannel.ServiceId);
   if (dbPortalChannel == null)
   {
     Log.Info("Portal channel with networkId={0}, transportId={1}, serviceId={2} not found", pChannel.NetworkId,
              pChannel.TransportId, pChannel.ServiceId);
     return;
   }
   Gentle.Framework.Broker.Execute("delete from ChannelLinkageMap WHERE idPortalChannel=" + dbPortalChannel.IdChannel);
   foreach (LinkedChannel lChannel in pChannel.LinkedChannels)
   {
     Channel dbLinkedChannnel = layer.GetChannelByTuningDetail(lChannel.NetworkId, lChannel.TransportId,
                                                               lChannel.ServiceId);
     if (dbLinkedChannnel == null)
     {
       Log.Info("Linked channel with name={0}, networkId={1}, transportId={2}, serviceId={3} not found",
                lChannel.Name, lChannel.NetworkId, lChannel.TransportId, lChannel.ServiceId);
       continue;
     }
     dbLinkedChannnel.DisplayName = lChannel.Name;
     dbLinkedChannnel.Persist();
     ChannelLinkageMap map = new ChannelLinkageMap(dbPortalChannel.IdChannel, dbLinkedChannnel.IdChannel,
                                                   lChannel.Name);
     map.Persist();
   }
 }
 private static bool IsNewLinkedChannel(PortalChannel pChannel, LinkedChannel lChannel)
 {
   bool bRet = true;
   foreach (LinkedChannel lchan in pChannel.LinkedChannels)
   {
     if ((lchan.NetworkId == lChannel.NetworkId) && (lchan.TransportId == lChannel.TransportId) &&
         (lchan.ServiceId == lChannel.ServiceId))
     {
       bRet = false;
       break;
     }
   }
   return bRet;
 }
 private static bool SameAsPortalChannel(PortalChannel pChannel, LinkedChannel lChannel)
 {
   return ((pChannel.NetworkId == lChannel.NetworkId) && (pChannel.TransportId == lChannel.NetworkId) &&
           (pChannel.ServiceId == lChannel.ServiceId));
 }