use SQL IF Exist condition with nHibernate on code behind C#?
===

I am trying something

    public IList<string> GetSearchResultList()
    {
       IList<int> IdList = GetAllID(); //getting the list of ID
       NHibernate.ISessionFactory sessionfactory = NHibernateHelper.GetSessionFactory();
       NHibernate.ISession session = sessionfactory.OpenSession();
       StringBuilder querybuilder = new StringBuilder();

        foreach (var item in IdList)
        {
         //IF Not Exists(SELECT [Results].Term, [Results].TextArea FROM [Results] WHERE [Results].Id=item)
	   	//begin
		//select ElementType FROM Element WHERE Id = item
		//end
                
         }
            
         IQuery query = session.CreateSQLQuery(querybuilder.ToString());

         return query.List<string>();
        }


here I am getting the list of ID in IdList, Now I want to pass the ID one by one is Results table if It will get the result then leave that result and if it will not get result then I need to pass that id into Element table and get the result and store the result with that id. I have tried but not getting proper syntax.

    
Please some one help me.
