public void Render(ITableBuilder tableBuilder, object model, RenderingTemplate template)
        {
            var lastRow = template.Content.Cells.LastOrDefault();

            foreach (var row in template.Content.Cells)
            {
                foreach (var cell in row)
                {
                    tableBuilder.PushState(new Style(cell));

                    if (TemplateDescriptionHelper.IsCorrectFormValueDescription(cell.StringValue))
                    {
                        RenderFormControl(tableBuilder, model, cell);
                    }
                    else
                    {
                        RenderCellularValue(tableBuilder, model, cell);
                    }

                    tableBuilder.PopState();
                }
                if (!row.Equals(lastRow))
                {
                    tableBuilder.MoveToNextLayer();
                }
            }
            MergeCells(tableBuilder, template);
            ResizeColumns(tableBuilder, template);
        }
        public void Render(ITableBuilder tableBuilder, object model, RenderingTemplate template)
        {
            if (!TypeCheckingHelper.IsEnumerable(model.GetType()))
            {
                throw new ArgumentException("model is not IEnumerable");
            }

            var enumerableToRender = ((IEnumerable)model).Cast <object>().ToArray();

            for (var i = 0; i < enumerableToRender.Length; ++i)
            {
                var element = enumerableToRender[i];

                var normalizedElement = NormalizeElement(element);

                tableBuilder.PushState();

                var renderer = rendererCollection.GetRenderer(normalizedElement.GetType());
                renderer.Render(tableBuilder, normalizedElement, template);

                tableBuilder.PopState();

                if (i != enumerableToRender.Length - 1)
                {
                    tableBuilder.MoveToNextLayer();
                }
            }
        }