/// <summary>
        /// Replaces the engine matching 'T' with the specified one
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="engines"></param>
        /// <param name="replacement"></param>
        public static void ReplaceEngine <T>(this ViewEngineCollection engines, IViewEngine replacement)
            where T : IViewEngine
        {
            var engine = engines.SingleOrDefault(x => x.GetType() == typeof(T));

            if (engine != null)
            {
                engines.Remove(engine);
            }
            engines.Add(replacement);
        }