private Commit GetLastCommit(AbstractTreeNode item, Branch branch, Commit commit)
        {
            if (branch != null)
            {
                return item.GetLastCommit(branch);
            }
            else if (commit != null)
            {
                return item.GetLastCommitBefore(commit);
            }

            return null;
        }
 private static GitSourceObject CreateGitSourceObject(string tree, AbstractTreeNode node)
 {
     if (node.IsTree)
     {
         var treeNode = (Tree)node;
         return new GitSourceDirectory
         {
             Name = treeNode.Name,
             IsDirectory = true,
             CommitId = treeNode.GetLastCommit().Hash,
             TreeId = tree,
             Path = node.Path,
             DateTime = treeNode.GetLastCommit().CommitDate.DateTime,
             Message = treeNode.GetLastCommit().Message,
             Children = treeNode.Trees.Select(x => CreateGitSourceObject(tree, x))
                 .Union(treeNode.Leaves.Select(x => CreateGitSourceObject(tree, x)))
         };
     }
     else
     {
         var leafNode = (Leaf)node;
         return new GitSourceFile
         {
             Name = node.Name,
             IsDirectory = false,
             CommitId = leafNode.GetLastCommit().Hash,
             TreeId = tree,
             Path = node.Path,
             DateTime = node.GetLastCommit().CommitDate.DateTime,
             Message = node.GetLastCommit().Message,
             Content = leafNode.RawData
         };
     }
 }