private static string BuildRow(CarType carType, ICollection<PriceTypeValue> list) { var sb = new StringBuilder(); var rowspan = list.Count() - 1; var first = list.First(); sb.AppendLine("<tr>"); sb.AppendLine(string.Format("<td rowspan=\"{0}\">{1}</td>", rowspan, carType.Localize())); sb.AppendLine(string.Format("<td>{0}</td>", first.PriceType.Localize())); sb.AppendLine(string.Format("<td>{0:n0}</td>", first.Value)); var wax = list.First(x => x.PriceType == PriceType.Wax); sb.AppendLine(string.Format("<td rowspan=\"{0}\">{1:n0}</td>", rowspan, wax.Value)); sb.AppendLine("</tr>"); list.Remove(first); foreach (var item in list.Where(x => x.PriceType != PriceType.Wax)) { sb.AppendLine("<tr>"); sb.AppendLine(string.Format("<td>{0}</td>", item.PriceType.Localize())); sb.AppendLine(string.Format("<td>{0:n0}</td>", item.Value)); sb.AppendLine("</tr>"); } return sb.ToString(); }