public IProfile Create(string profileName)
        {
            if (Exists(profileName))
            {
                throw new Core.Services.ProfileNameConflictException(profileName);
            }

            string       profilePath     = ProfilePath(profileName);
            FileInfoBase profileFileInfo = _fileSystem.FileInfo.FromFileName(profilePath);
            StreamWriter writer          = profileFileInfo.CreateText();

            using (CsvHelper.CsvWriter csvWriter = new CsvHelper.CsvWriter(writer, leaveOpen: false))
            {
                csvWriter.Configuration.QuoteAllFields = true;
                csvWriter.Configuration.RegisterClassMap(new CSV.MatchRecordConfiguration());

                csvWriter.WriteHeader <MatchRecord>();
                csvWriter.NextRecord();
            }

            FileSystemProfile profile = new FileSystemProfile(_fileSystem, profileName, profilePath);

            AddToCache(profileName, profile);
            return(profile);
        }
        public IProfile Get(string profileName)
        {
            if (!Exists(profileName))
            {
                return(null);
            }

            if (IsInCache(profileName))
            {
                return(CacheEntry(profileName));
            }

            FileSystemProfile profile = new FileSystemProfile(_fileSystem, profileName, ProfilePath(profileName));

            AddToCache(profileName, profile);
            return(profile);
        }
 private void AddToCache(string profileName, FileSystemProfile profile)
 {
     _profileCache.Add(profileName, profile);
 }