public static DeploymentSequence ToReleaseTemplate(this RMDeploymentSequence sequence)
        {
            var doc = XDocument.Parse(sequence.WorkflowXaml);

            if (doc.Root == null)
            {
                throw new InvalidDataException("XML is not a valid release template.");
            }

            if (doc.Root.Elements(ActionParser.ActionActivity).Any())
            {
                throw new UnsupportedReleaseTemplateTypeException();
            }

            var sequenceName = doc.Root?.Attribute("DisplayName").Value;
            var seq = new DeploymentSequence
            {
                ReleaseTemplateName = sequence.ReleaseTemplateName,
                ReleaseTemplateStageName = sequence.ReleaseTemplateStageName,
                DisplayName = sequenceName,
                ReleaseTemplateStageId = sequence.StageId,
                Containers = ContainerParser.ProcessContainers(doc.Root?.Elements())
            };
            return seq;
        }
        /// <summary>
        /// Generates the script.
        /// </summary>
        /// <param name="sequence">
        /// The sequence.
        /// </param>
        /// <param name="targetPath">
        /// The target path.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task GenerateScriptAsync(DeploymentSequence sequence, string targetPath)
        {
            this.deployerToolsPath = Path.Combine(targetPath, "DeployerTools");
            var tokenScriptPath = Path.Combine(this.deployerToolsPath, "TokenizationScript.ps1");

            this.fs.CreateDirectory(this.deployerToolsPath);

            if (!this.fs.Exists(tokenScriptPath))
            {
                var tokenScript = new TokenizationScript();
                this.fs.WriteAllText(tokenScriptPath, tokenScript.TransformText());
            }

            foreach (var container in sequence.Containers)
            {
                await this.ProcessContainerContainerAsync(sequence.ReleaseTemplateStageId, container, targetPath);
            }
        }