public static ControlDependencyMap BuildDependencyMap(Type type)
{
var dependencies = new List<Type>();
SeekDependencies(type, ref dependencies);
var scriptDependencies = dependencies
.Where(m => m.GetCustomAttributes(true).Any(a => a is RequiredScriptAttribute || a is ClientScriptResourceAttribute))
.ToList();
scriptDependencies.Add(type);
return new ControlDependencyMap(type, scriptDependencies.Distinct().ToArray());
}