public IIndex <TKey, TSource> BuildIndex(IEnumerable <TSource> source, IndexType indexType, bool recalculateIndex = false)
 {
     if (this.indexType == indexType)
     {
         if (IndexCollection == null || recalculateIndex)
         {
             Func <TSource, TKey>   keySelectorExecutable = KeySelector.Compile();
             IIndex <TKey, TSource> indexCollection       = null;
             if (indexType == IndexType.EqualIndex)
             {
                 indexCollection = source.IndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable);
             }
             else
             {
                 indexCollection = source.UnequalIndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable);
             }
             IndexCollection = indexCollection;
         }
         return(IndexCollection);
     }
     else
     {
         if (IndexCollection == null || recalculateIndex)
         {
             this.indexType = indexType;
             Func <TSource, TKey>   keySelectorExecutable = KeySelector.Compile();
             IIndex <TKey, TSource> indexCollection       = null;
             if (indexType == IndexType.EqualIndex)
             {
                 indexCollection = source.IndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable);
             }
             else
             {
                 indexCollection = source.UnequalIndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable);
             }
             IndexCollection = indexCollection;
         }
         return(IndexCollection);
     }
 }