public void Remove(Subscription subscription)
        {
            try
            {
                using (ISession session = _factory.OpenSession())
                    using (ITransaction transaction = session.BeginTransaction())
                    {
                        ICriteria criteria = session.CreateCriteria(typeof(PersistentSubscription));

                        criteria.Add(Restrictions.Eq("Address", subscription.EndpointUri.ToString()))
                        .Add(Restrictions.Eq("MessageName", subscription.MessageName));

                        PersistentSubscription obj = criteria.UniqueResult <PersistentSubscription>();
                        if (obj != null)
                        {
                            obj.IsActive = false;
                            session.Update(obj);
                        }

                        transaction.Commit();
                    }
            }
            catch (Exception ex)
            {
                _log.Error(string.Format("Error removing message {0} for address {1} from the repository", subscription.MessageName, subscription.EndpointUri), ex);
                throw;
            }
        }
		public void Save(Subscription subscription)
		{
			try
			{
				using (ISession session = _factory.OpenSession())
				using (ITransaction transaction = session.BeginTransaction())
				{
					ICriteria criteria = session.CreateCriteria(typeof (PersistentSubscription));

					criteria.Add(Restrictions.Eq("Address", subscription.EndpointUri.ToString()))
						.Add(Restrictions.Eq("MessageName", subscription.MessageName));

					PersistentSubscription obj = criteria.UniqueResult<PersistentSubscription>();
					if (obj == null)
					{
						obj = new PersistentSubscription(subscription);
						session.Save(obj);
					}
					else
					{
						obj.IsActive = true;
						session.Update(obj);
					}

					transaction.Commit();
				}
			}
			catch (Exception ex)
			{
				_log.Error(string.Format("Error adding message {0} for address {1} to the repository", subscription.MessageName, subscription.EndpointUri), ex);
				throw;
			}
		}