protected override void OnInitializeTask()
        {
            var fileLanguageDirections = TaskFiles.Select(x => x.GetLanguageDirection().TargetLanguage.IsoAbbreviation).Distinct();

            if (fileLanguageDirections.Count() > 1)
            {
                throw new Exception(
                          $"This batch task can only be applied to one language direction at a time. Select only files with same language direction and try again.");
            }
            else if (fileLanguageDirections.Count() == 0)
            {
                throw new Exception(
                          $"No target files selected.");
            }
            this.collectedSentencePairCount = 0;
            this.settings       = GetSetting <FinetuneBatchTaskSettings>();
            this.opusCatOptions = new OpusCatOptions(new Uri(this.settings.ProviderOptions));

            //Use project guid in case no model tag specified
            if (this.opusCatOptions.modelTag == "")
            {
                this.opusCatOptions.modelTag = this.Project.GetProjectInfo().Id.ToString();
            }

            //Get instances of the translation memories included in the project.
            this.tms = this.InstantiateProjectTms();

            this.ProjectTranslations = new Dictionary <Language, List <Tuple <string, string> > >();
            this.ProjectNewSegments  = new Dictionary <Language, List <string> >();
            this.ProjectFuzzies      = new Dictionary <Language, List <TranslationUnit> >();
            this.sourceVisitor       = new OpusCatProviderElementVisitor();
            this.targetVisitor       = new OpusCatProviderElementVisitor();
            base.OnInitializeTask();
        }
        /// <summary>
        /// Instantiates the variables and fills the list file content into
        /// a Dictionary collection object.
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="languages"></param>
        #region "ListTranslationProviderLanguageDirection"
        public OpusCatProviderLanguageDirection(OpusCatProvider provider, LanguagePair languages)
        {
            #region "Instantiate"

            _provider          = provider;
            _languageDirection = languages;
            _options           = _provider.Options;

            _visitor = new OpusCatProviderElementVisitor();

            var sourceCode = this._languageDirection.SourceCulture.TwoLetterISOLanguageName;
            var targetCode = this._languageDirection.TargetCulture.TwoLetterISOLanguageName;
            this.langpair = $"{sourceCode}-{targetCode}";

            #endregion
        }