private string RenderVariable(
            string param,
            Dictionary <string, object> variableDictionary)
        {
            string       objectParam;
            int?         objectArrayIndex;
            IHasTemplate obj = GetVarObject(param, variableDictionary, out objectParam, out objectArrayIndex) as IHasTemplate;

            if (obj == null)
            {
                obj = GetVariable(objectParam, variableDictionary, objectArrayIndex) as IHasTemplate;
            }

            if (string.IsNullOrEmpty(obj.TemplateName()))
            {
                ThrowTemplateException(
                    string.Format("Render called but the object does not have a template: {0}. {1}.",
                                  param,
                                  obj.ToString()));
            }

            IHasProps objProps = obj as IHasProps;


            variableDictionary["this"] = objProps;
            string rv = FormatTemplate(obj.TemplateName(), variableDictionary);

            variableDictionary.Remove("this");
            return(rv);
        }