private string GetPathToTemplateFile(FilePath filePath, bool optional)
        {
            var assemblyLocation = new FilePath((typeof(TemplateFileProvider).GetTypeInfo().Assembly.Location)).GetDirectory();
            var srcLocation      = filePath;

            for (int i = 0; i < 5; i++)
            {
                var fullSrcLocation = assemblyLocation.CombineWithFilePath(srcLocation).FullPath;
                if (File.Exists(fullSrcLocation))
                {
                    return(fullSrcLocation);
                }
                srcLocation = "../" + srcLocation;
            }
            if (!optional)
            {
                throw new InvalidOperationException(
                          $"Cannot find template file '{filePath}' at '{assemblyLocation}' or its parent directories.");
            }
            return(null);
        }