protected void PrepareMediaSources()
        {
            Dictionary <string, ICollection <MediaCategory> > checkFolders = new Dictionary <string, ICollection <MediaCategory> >();
            List <string> recordingFolders;
            string        singlePattern;
            string        seriesPattern;

            if (!GetRecordingConfiguration(out recordingFolders, out singlePattern, out seriesPattern))
            {
                ServiceRegistration.Get <ILogger>().Warn("SlimTvService: Unable to configure MediaSource for recordings, probably TV configuration wasn't run yet.");
                return;
            }

            string movieSubfolder  = GetFixedFolderPart(singlePattern);
            string seriesSubfolder = GetFixedFolderPart(seriesPattern);

            foreach (var recordingFolder in recordingFolders)
            {
                if (!string.IsNullOrEmpty(movieSubfolder) && !string.IsNullOrEmpty(seriesSubfolder))
                {
                    // If there are different target folders defined, register the media sources with specialized Series/Movie types
                    checkFolders.Add(FileUtils.CheckTrailingPathDelimiter(Path.Combine(recordingFolder, movieSubfolder)), new HashSet <MediaCategory> {
                        DefaultMediaCategories.Video, Movie
                    });
                    checkFolders.Add(FileUtils.CheckTrailingPathDelimiter(Path.Combine(recordingFolder, seriesSubfolder)), new HashSet <MediaCategory> {
                        DefaultMediaCategories.Video, Series
                    });
                }
                else
                {
                    checkFolders.Add(FileUtils.CheckTrailingPathDelimiter(recordingFolder), new HashSet <MediaCategory> {
                        DefaultMediaCategories.Video
                    });
                }
            }

            IMediaLibrary mediaLibrary = ServiceRegistration.Get <IMediaLibrary>();
            int           cnt          = 1;

            foreach (var folderTypes in checkFolders)
            {
                try
                {
                    List <Share> shares;
                    // Check if there are already share(s) for the folder
                    var path         = folderTypes.Key;
                    var resourcePath = BuildResourcePath(path);

                    if (GetSharesForPath(resourcePath, out shares))
                    {
                        continue;
                    }

                    var mediaCategories = folderTypes.Value.Select(mc => mc.CategoryName);

                    Share sd = Share.CreateNewLocalShare(resourcePath, string.Format("Recordings ({0})", cnt),
                                                         // Important: don't monitor recording sources by ShareWatcher, we manage them during recording start / end events!
                                                         false,
                                                         mediaCategories);

                    mediaLibrary.RegisterShare(sd);
                    cnt++;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("SlimTvService: Error registering new MediaSource.", ex);
                }
            }
        }