private void InnerTranslate(IAsset asset, BabelJsCompiler babelJsCompiler)
        {
            string newContent;
            var assetVirtualPath = asset.VirtualPath;
            var options = CreateCompilationOptions(_babelJsConfig);

            try
            {
                newContent = babelJsCompiler.Compile(asset.Content, assetVirtualPath, options);
            }
            catch (BabelJsCompilerException e)
            {
                throw new AssetTranslationException(
                    string.Format(CoreStrings.Translators_TranslationSyntaxError,
                        INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetVirtualPath, e.Message));
            }
            catch (Exception e)
            {
                throw new AssetTranslationException(
                    string.Format(CoreStrings.Translators_TranslationFailed,
                        INPUT_CODE_TYPE, OUTPUT_CODE_TYPE, assetVirtualPath, e.Message));
            }

            asset.Content = newContent;
        }
        /// <summary>
        /// Translates a code of asset written on EcmaScript2015 to JS-code
        /// </summary>
        /// <param name="asset">Asset with code written on EcmaScript2015</param>
        /// <returns>Asset with translated code</returns>
        public IAsset Translate(IAsset asset)
        {
            if (asset == null)
            {
                throw new ArgumentException(CoreStrings.Common_ValueIsEmpty, "asset");
            }

            using (var babelJsCompiler = new BabelJsCompiler(_createJsEngineInstance))
            {
                InnerTranslate(asset, babelJsCompiler);
            }

            return asset;
        }
        /// <summary>
        /// Translates a code of assets written on EcmaScript2015 to JS-code
        /// </summary>
        /// <param name="assets">Set of assets with code written on EcmaScript2015</param>
        /// <returns>Set of assets with translated code</returns>
        public IList<IAsset> Translate(IList<IAsset> assets)
        {
            if (assets == null)
            {
                throw new ArgumentException(CoreStrings.Common_ValueIsEmpty, "assets");
            }

            if (assets.Count == 0)
            {
                return assets;
            }

            var assetsToProcessing = assets.Where(a => a.AssetTypeCode == AssetTypeCode.EcmaScript2015).ToList();
            if (assetsToProcessing.Count == 0)
            {
                return assets;
            }

            using (var babelJsCompiler = new BabelJsCompiler(_createJsEngineInstance))
            {
                foreach (var asset in assetsToProcessing)
                {
                    InnerTranslate(asset, babelJsCompiler);
                }
            }

            return assets;
        }