//возвращаем лист id фильмов с id жанров
        private List <Films_Genres> GetFilmGenres(Film obj)
        {
            List <Films_Genres> tmpList = new List <Films_Genres>();
            int lastId = GetLastId();

            foreach (var item in obj.GenresList)
            {
                Films_Genres tmpFG = new Films_Genres();
                tmpFG.Id_Film    = lastId;
                tmpFG.Id_Genres  = item.Id;
                tmpFG.Index_List = (obj.GenresList as List <Genre>).FindIndex(s => string.Equals(s.Title, item.Title, StringComparison.CurrentCultureIgnoreCase));
                tmpList.Add(tmpFG);
            }
            return(tmpList);
        }
 //обновление связанных строчек с фильмом в таблице Films_Genres
 private void UpdateFilms_Genres(Film obj)
 {
     DeleteFilms_Genres("Id", obj.Id);
     using (ISession session = Singleton.Instance.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             int i = 0;
             foreach (var item in obj.GenresList)
             {
                 Films_Genres tmpFG = new Films_Genres()
                 {
                     Id_Film    = obj.Id,
                     Id_Genres  = item.Id,
                     Index_List = i
                 };
                 session.Save(tmpFG);
                 i++;
             }
             transaction.Commit();
         }
     }
 }