internal static string ShortenIfNeeded(string name, int maxLength)
{
if (name.Length < maxLength)
return name;
var sections = ParseSectionsForNameShortening(name);
int needRemove = name.Length - maxLength;
SelectSubsectionsToRemove(name, sections, needRemove);
var sb = new StringBuilder(maxLength);
AddNameShorteningSection(name, sections, sections.Count - 1, name.Length, sb);
return sb.ToString();
}