/// <summary>
        /// Executes the <see cref="TagHelper"/> with the given context and output.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (Policy != null)
            {
                if (!RequestContext.HttpContext.User.HasClaim(f => f.Type == Policy))
                {
                    output.SuppressOutput();
                    return;
                }
            }

            // Stores the inner content of the control. Uses a function to allow the invocation of the children after the parent.
            childContent = () => output.GetChildContentAsync();

            // Clears the output.
            output.SuppressOutput();

            // Renders the control html.
            var control = RenderControl(context, output);

            if (control != null)
            {
                if (context.IsInnerContent())
                {
                    // If the control is an inner control, remove the tag data-control.
                    control.Attributes.Remove("data-control");
                }

                // Adds the html standard attributes
                foreach (var attr in output.Attributes)
                {
                    if (attr.Name == "class")
                    {
                        control.AddCssClass(attr.Value.ToString());
                    }
                    else
                    {
                        control.Attributes.Add(attr.Name, attr.Value.ToString());
                    }
                }

                output.Content.AppendHtml(control);
            }
        }
        /// <summary>
        /// Creates the framework control.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>The control instance.</returns>
        protected sealed override IFWHtmlElement RenderControl(TagHelperContext context, TagHelperOutput output)
        {
            // TODO: template of input control is still experimental and might need fixing.
            IFWTemplateOptions templateOptions = null;

            if (context.IsInnerContent() && Name != null)
            {
                templateOptions = context.Items["TemplateOptions"] as IFWTemplateOptions;
                var metadata = RequestContext.MetadataProvider.GetMetadataForType(templateOptions.ItemType);
                For = new ModelExpression(Name, new ModelExplorer(RequestContext.MetadataProvider, metadata, $"{{{Name}}}"));
            }

            var control = RenderInputControl(context, output);

            if (templateOptions != null)
            {
                control.Id   = $"{templateOptions.Id}_{Name}_{{FWTemplateIndex}}";
                control.Name = $"{templateOptions.Id}.{Name}"; //$"{templateOptions.Id}.{Name}[{{Index}}]";
            }

            if (HideLabel.HasValue)
            {
                control.DisplayLabel = !HideLabel.Value;
            }

            if (IsDisabled.HasValue)
            {
                control.IsDisabled = IsDisabled.Value;
            }

            if (IsReadonly.HasValue)
            {
                control.IsReadOnly = IsReadonly.Value;
            }

            control.Tooltip = Tooltip;

            return(control);
        }