protected virtual string BuildChangeHistory(int id)
        {
            string result = string.Empty;
            EntityData entityData = new EntityData();

            List<EntityDTO> changeHistory = entityData.GetChangeHistory(id);
            ChangeHistoryComparer comparer = new ChangeHistoryComparer();
            changeHistory.Sort(comparer);
            if (changeHistory.Count > 0)
            {
                HtmlTable t = new HtmlTable(4, 0, "grid");
                //t.AddHeader(GlobalStringResource.ChangeHistory, 4);

                t.AddHeader(GlobalStringResource.Version);
                t.AddHeader(GlobalStringResource.Date);
                t.AddHeader(GlobalStringResource.ReasonforChange);
                t.AddHeader(GlobalStringResource.AuthorOnly);

                foreach (EntityDTO related in changeHistory)
                {
                    related.ExtractProperties();
                    t.AddCell(related.RenderHTML(GlobalStringResource.Version, RenderOption.Span));
                    t.AddCell(related.RenderHTML(GlobalStringResource.Date, RenderOption.Span));
                    t.AddCell(related.RenderHTML(GlobalStringResource.ReasonforChange, RenderOption.Span));

                    List<EntityDTO> users = entityData.GetRelatedPersons(related.ID);

                    StringBuilder userLinks = new StringBuilder();
                    if (users.Count > 0)
                    {
                        foreach (EntityDTO user in users)
                        {
                            userLinks.Append(user.RenderAsPopupLink());
                            userLinks.Append(GlobalStringResource.BreakTag);
                        }
                    }

                    t.AddCell(userLinks.ToString());
                }
                result = t.EndHtmlTable();
            }

            return result;
        }
        private List<ChangeHistoryItem> ChangeHistory(int id)
        {
            List<ChangeHistoryItem> items = new List<ChangeHistoryItem>();
            EntityData entityData = new EntityData();

            List<EntityDTO> changeHistory = entityData.GetChangeHistory(id);
            ChangeHistoryComparer comparer = new ChangeHistoryComparer();
            changeHistory.Sort(comparer);
            if (changeHistory.Count > 0)
            {
                foreach (EntityDTO related in changeHistory)
                {
                    ChangeHistoryItem ch = new ChangeHistoryItem();
                    related.ExtractProperties();
                    ch.Version = related.RenderHTML(GlobalStringResource.Version, RenderOption.Span);
                    ch.Date = related.RenderHTML(GlobalStringResource.Date, RenderOption.Span);
                    ch.Reason = related.RenderHTML(GlobalStringResource.ReasonforChange, RenderOption.Span);

                    List<EntityDTO> users = entityData.GetRelatedPersons(related.ID);

                    StringBuilder userLinks = new StringBuilder();
                    if (users.Count > 0)
                    {
                        foreach (EntityDTO user in users)
                        {
                            userLinks.Append(user.RenderAsPopupLink());
                            userLinks.Append(GlobalStringResource.BreakTag);
                        }
                    }
                    ch.Author = userLinks.ToString();
                    items.Add(ch);
                }
            }
            return items;
        }