public string ReadTemplateFile(liquid.Context context, string templateName)
        {
            // Find the template referenced by the passed templateName
            ViewLocationResult viewLocation = nancyContext.ViewLocationResults.FirstOrDefault(v => ReplaceTroubleChars(v.Name) == ReplaceTroubleChars(templateName));

            if (viewLocation != null)
            {
                return viewLocation.Contents.Invoke().ReadToEnd();
            }

            throw new liquid.Exceptions.FileSystemException("Template file {0} not found", new[] { templateName });
        }
        /// <summary>
        /// Reads the content of the template specified by the <paramref name="templateName"/> parameter.
        /// </summary>
        /// <param name="context">The <see cref="Context"/> of the call.</param>
        /// <param name="templateName">The name of the template to read.</param>
        /// <exception cref="liquid.Exceptions.FileSystemException">The specified template could not be located.</exception>
        /// <returns>The content of the template.</returns>
        public string ReadTemplateFile(liquid.Context context, string templateName)
        {
            IRenderContext renderContext = context.Registers["nancy"] as IRenderContext;
            if (renderContext != null)
            {
                // Clean up the template name
                templateName = GetCleanTemplateName(templateName);

                // Try to find a matching template using established view conventions
                ViewLocationResult viewLocation = null;
                if (extensions.Any(
                    s => templateName.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
                {
                    // The template name does end with a valid extension, just try to find it
                    viewLocation = renderContext.LocateView(templateName, null);
                }
                else
                {
                    // The template name does not end with a valid extension, try all the possibilities
                    foreach (string extension in extensions)
                    {
                        viewLocation = renderContext.LocateView(String.Concat(templateName, ".", extension), null);
                        if (viewLocation != null) break;
                    }
                }

                // If we found one, get the template and pass it back
                // Eventually, it would be better to pass back the actual template from the cache if it's already been parsed
                // Or to parse here and store it in the cache before passing it back in not
                if (viewLocation != null)
                {
                    using (var reader = viewLocation.Contents.Invoke())
                        return reader.ReadToEnd();
                }
            }
            throw new FileSystemException("Template file {0} not found", new[] { templateName });
        }