public JsonResult GetNodeItems(string parentId)
        {
            var treeNodes = new List <TreeNode>();

            using (var masterPassword = SessionContext.GetMasterPassword())
            {
                var currentVault = SessionContext.GetCurrentVaultName();

                var vaultRepository = VaultRepositoryFactory.CreateInstance();
                var vault           = vaultRepository.GetVault(currentVault, masterPassword);
                if (parentId == "#")
                {
                    //Root
                    treeNodes.AddRange(vault.Groups.Select(group => CreateTreeNode(group.Id.ToString(), group.Name, parentId, group.Groups.Count > 0, true, group.Entries.Count)));
                }
                else
                {
                    var vaultManipulator = VaultManipulatorFactory.CreateInstance(vault);
                    var parentGroup      = vaultManipulator.GetGroupById(Guid.Parse(parentId));

                    treeNodes.AddRange(parentGroup.Groups.Select(group => CreateTreeNode(group.Id.ToString(), group.Name, parentId, group.Groups.Count > 0, false, group.Entries.Count)));
                    //treeNodes.AddRange(parentGroup.Entries.Select(entry => CreateTreeNode(entry.Id.ToString(), entry.Title, parentId, false, false, false)));
                }

                return(Json(treeNodes));
            }
        }
        public Vault CreateVault(string vaultName)
        {
            var vault = new Vault();

            vault.Name = vaultName;
            var vaultHandler = VaultHandlerFactory.CreateInstance(vault);
            var group        = new Group()
            {
                Name = "General"
            };

            vaultHandler.AddGroup(null, group);

            return(vault);
        }