public static IIndex CreateForeignKeyIndex <TEntity, TPrimaryKey, TForeignKey>(
                Table <TEntity, TPrimaryKey> table,
                IKeyInfo <TEntity, TForeignKey> foreignKeyinfo)
                where TEntity : class
            {
                var indexFactory = new RedBlackTreeIndexFactory();

                ////var indexFactory = new DictionaryIndexFactory<TEntity, TPrimaryKey, TEntity>();
                return(table.CreateIndex <TForeignKey>(indexFactory, foreignKeyinfo));
            }
            public static IIndex <TEntity, TKey> CreateIndex <TEntity, TPrimaryKey, TKey>(
                Table <TEntity, TPrimaryKey> table,
                IKeyInfo <TEntity, TKey> key,
                bool unique)

                where TEntity : class
            {
                IIndexFactory factory = new RedBlackTreeIndexFactory();

                if (unique)
                {
                    return(table.CreateUniqueIndex(factory, key));
                }
                else
                {
                    return(table.CreateIndex(factory, key));
                }
            }