internal static BaseTree GetLegacyTreeForLegacyServices(Core.Models.ApplicationTree appTree)
        {
            if (appTree == null) throw new ArgumentNullException("appTree");

            BaseTree tree;

            var controllerAttempt = appTree.TryGetControllerTree();
            if (controllerAttempt.Success)
            {
                var legacyAtt = controllerAttempt.Result.GetCustomAttribute<LegacyBaseTreeAttribute>(false);
                if (legacyAtt == null)
                {
                    LogHelper.Warn<LegacyTreeDataConverter>("Cannot render tree: " + appTree.Alias + ". Cannot render a " + typeof(TreeController) + " tree type with the legacy web services unless attributed with " + typeof(LegacyBaseTreeAttribute));
                    return null;
                }

                var treeDef = new TreeDefinition(
                    legacyAtt.BaseTreeType,
                    new ApplicationTree(false, true, (byte)appTree.SortOrder, appTree.ApplicationAlias, appTree.Alias, appTree.Title, appTree.IconClosed, appTree.IconOpened, "", legacyAtt.BaseTreeType.GetFullNameWithAssembly(), ""),
                    new Application(appTree.Alias, appTree.Alias, "", 0));

                tree = treeDef.CreateInstance();
                tree.TreeAlias = appTree.Alias;

            }
            else
            {
                //get the tree that we need to render                    
                var treeDef = TreeDefinitionCollection.Instance.FindTree(appTree.Alias);
                if (treeDef == null)
                {
                    return null;
                }
                tree = treeDef.CreateInstance();
            }

            return tree;
        }