private ItemObject[] DiscoverObjects(Xbox xbox, string directoryPath) { //Get items xbox.GetDirectoryList(directoryPath, out var nestedItems); List <ItemObject> items = new List <ItemObject>(); //Add foreach (var file in nestedItems.Where(i => !i.Attributes.HasFlag(FileAttributes.Directory))) { items.Add(new ItemObject() { Attributes = (uint)file.Attributes, Created = file.Created, Directory = file.Directory, Modified = file.Modified, Name = file.Name, Size = file.Size, }); } //Recursively access items foreach (var directory in nestedItems.Where(i => i.Attributes.HasFlag(FileAttributes.Directory))) { items.AddRange(DiscoverObjects(xbox, Path.Combine(directory.Directory, directory.Name))); } //Return return(items.ToArray()); }