protected override void BeginProcessing()
 {
     if (ParameterSetName == "Identity")
     {
         if (MyInvocation.BoundParameters.ContainsKey("Path"))
         {
             if (!System.IO.Path.IsPathRooted(Path))
             {
                 Path = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, Path);
             }
             GalleryHelper.SaveTemplate(Identity, Path, s =>
             {
                 if (Force || ShouldContinue(string.Format(Resources.File0ExistsOverwrite, s), Resources.Confirm))
                 {
                     return(true);
                 }
                 return(false);
             }, f =>
             {
                 WriteObject($"Template saved: {f}");
             });
         }
         else
         {
             var template = GalleryHelper.GetTemplate(Identity);
             if (template != null)
             {
                 WriteObject(template);
             }
         }
     }
     else
     {
         WriteObject(GalleryHelper.SearchTemplates(Search, TargetPlatform, TargetScope).ToArray(), true);
     }
 }