private SCollection[] GetInteractivePeople()
        {
            List<GitHubObject> objects = new List<GitHubObject>();
            Dictionary<GitHubRepositories, List<GitHubObject>> dictionaryFiles = new Dictionary<GitHubRepositories, List<GitHubObject>>();

            Contract.Requires(!String.IsNullOrEmpty(_host));

            String jsonUser = WebRequest(_host + "user");
            GitHubUser currentUser;
            String jsonUserRepositories;
            GitHubRepositories[] publicRepositories;
            String jsonOrganizations;
            GitHubOrganization[] organizations;

            currentUser = (jsonUser !=  "" ? JsonConvert.DeserializeObject<GitHubUser>(jsonUser) : null);
            jsonUserRepositories = (currentUser != null ? WebRequest(currentUser.repos_url) : null);
            publicRepositories = ( jsonUserRepositories != null ? JsonConvert.DeserializeObject<GitHubRepositories[]>(jsonUserRepositories) : null);
            jsonOrganizations = (currentUser != null? WebRequest(currentUser.organizations_url) : null);
            organizations = (jsonOrganizations != null ? JsonConvert.DeserializeObject<GitHubOrganization[]>(jsonOrganizations) : null);

            if (publicRepositories != null && publicRepositories.Length > 0)
            {
                 string url = ( publicRepositories[0].contents_url.Contains('{') ? publicRepositories[0].contents_url.Substring(0,findCharacter('{',publicRepositories[0].contents_url)) : publicRepositories[0].contents_url );
                 String jsonRootObjects = WebRequest(url);
                GitHubObject[] tempObjects = ( jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : null);
                 if (tempObjects.Length > 0)
                 {
                     objects.AddRange(tempObjects);
                 }

                 for (int i = 0; i < objects.Count; i++)
                 {
                     getRepositoriesFiles(ref objects, objects[i],ref i);
                 }

                 dictionaryFiles.Add(publicRepositories[0], objects);

                 if (publicRepositories.Length > 1)
                 {
                     for (int i = 1; i < publicRepositories.Length; i++)
                     {
                         objects = new List<GitHubObject>();

                         url = (publicRepositories[0].contents_url.Contains('{') ? publicRepositories[0].contents_url.Substring(0, findCharacter('{', publicRepositories[0].contents_url)) : publicRepositories[0].contents_url);
                         jsonRootObjects = WebRequest(url);
                         tempObjects = (jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : new GitHubObject[0]);
                         if (tempObjects.Length > 0)
                         {
                             objects.AddRange(tempObjects);
                         }

                         for (int j = 0; j < objects.Count; j++)
                         {
                             getRepositoriesFiles(ref objects, objects[j], ref j);
                         }

                         dictionaryFiles.Add(publicRepositories[i], objects);
                     }
                 }
            }
            if(organizations != null)
            {
            for (int i = 0; i < organizations.Length; i++)
            {
                string url = (organizations[i].repos_url.Contains('{') ? organizations[i].repos_url.Substring(0, findCharacter('{', organizations[i].repos_url)) : organizations[i].repos_url);
                String jsonOrgsRepositories = WebRequest(url);
                GitHubRepositories[] repositories = (jsonOrgsRepositories != null && jsonOrgsRepositories != "" ? JsonConvert.DeserializeObject<GitHubRepositories[]>(jsonOrgsRepositories) : null);

                if(repositories != null)
                {
                for (int j = 0; j < repositories.Length; j++)
                {
                    objects = new List<GitHubObject>();
                    url = (repositories[j].contents_url.Contains('{') ? repositories[j].contents_url.Substring(0, findCharacter('{', repositories[j].contents_url)) : repositories[j].contents_url);
                    String jsonRootObjects = WebRequest(url);
                    GitHubObject[] tempObjects = ( jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : new GitHubObject[0]);

                    if (tempObjects.Length > 0)
                    {
                        objects.AddRange(tempObjects);

                        for (int h = 0; h < objects.Count; h++)
                        {
                            getRepositoriesFiles(ref objects, objects[h], ref h);
                        }
                    }
                    dictionaryFiles.Add(repositories[j], objects);

                }
            }

            }
            }

            List<SCollection> result = new List<SCollection>();

            foreach (KeyValuePair<GitHubRepositories, List<GitHubObject>> pair in dictionaryFiles)
            {
                SCollection collection= new SCollection();
                collection.Uri = pair.Key.git_url;
               // collection.Uri = "ciao path";
                List<SFile> filesFounded = new List<SFile>();
                List<GitHubObject> list = pair.Value;

                for (int i = 0; i < list.Count; i++)
                {
                    SFile fileFounded = new SFile();
                    List<string> usernameUserInvolved = new List<string>();
                    fileFounded.Name = list[i].path ;
                   // fileFounded.Name = " ciao file";
                    String url = (pair.Key.commits_url.Contains('{') ? pair.Key.commits_url.Substring(0, findCharacter('{', pair.Key.commits_url)) : pair.Key.commits_url);
                    String jsonUsersInvolved = WebRequest(url + "?path="+ list[i].path);
                    GitHubCommit[] tempCommit = ( jsonUsersInvolved != null && !String.IsNullOrEmpty(jsonUsersInvolved)  ? JsonConvert.DeserializeObject<GitHubCommit[]>(jsonUsersInvolved) : new GitHubCommit[0]);

                    for (int j = 0; j < tempCommit.Length; j++)
                    {
                        if (tempCommit[j].committer != null && tempCommit[j].author != null)
                        {
                            usernameUserInvolved.Add(tempCommit[j].author.login);
                            usernameUserInvolved.Add(tempCommit[j].committer.login);
                        }
                    }
                    /*
                    if (usernameUserInvolved.Count > 0)
                    {
                        usernameUserInvolved.Add(currentUser.login);
                    }
                    */
                    fileFounded.InvolvedUsers = usernameUserInvolved.Distinct().ToArray();

                    filesFounded.Add(fileFounded);
                }

                collection.Files = filesFounded.ToArray();
                collection.WorkItems = new SWorkItem[0];
                result.Add(collection);

                System.Diagnostics.Debug.WriteLine("dizionario " + pair.Key.git_url);

            }

            return result.ToArray();
        }
        private SCollection[] GetInteractivePeople()
        {
            Contract.Requires(!String.IsNullOrEmpty(_host));
            List<SCollection> collections = new List<SCollection>(); //to return

            //obtaining user's teams
            string jsonTeams = WebRequest(_host + "user/teams");
            GitHubTeam[] userTeams = (!String.IsNullOrEmpty(jsonTeams)? JsonConvert.DeserializeObject<GitHubTeam[]>(jsonTeams): new GitHubTeam[0]);

            string jsonRepositories = "";
            GitHubRepositories[] repositories;
            for (int i = 0; i < userTeams.Length; i++)
            {
                //obtaining repositories' teams
                jsonRepositories = WebRequest(userTeams[i].repositories_url);
                repositories = (!String.IsNullOrEmpty(jsonRepositories)? JsonConvert.DeserializeObject<GitHubRepositories[]>(jsonRepositories) : new GitHubRepositories[0]);

                for (int j = 0; j < repositories.Length; j++)
                {
                    SCollection collection = new SCollection();
                    List<SFile> filesfounded = new List<SFile>();
                    List<SWorkItem> issuesfounded = new List<SWorkItem>();
                    List<GitHubObject> objects = new List<GitHubObject>();
                    try
                    {
                        string urlFiles = (repositories[j].contents_url.Contains('{') ? repositories[j].contents_url.Substring(0, findCharacter('{', repositories[j].contents_url)) : repositories[j].contents_url);
                        string jsonRootObjects = WebRequest(urlFiles);
                        GitHubObject[] files = (!String.IsNullOrEmpty(jsonRootObjects) ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : new GitHubObject[0]);

                        if (files.Length > 0)
                        {
                            objects.AddRange(files);
                        }

                        for (int k = 0; k < objects.Count; k++)
                        {
                            getRepositoriesFiles(ref objects, objects[k], ref k);
                        }

                        foreach (GitHubObject obj in objects)
                        {
                            //checking files
                            SFile fileFounded = new SFile();
                            List<string> usernameUserInvolved = new List<string>();
                            fileFounded.Name = obj.path;
                            String url = (repositories[j].commits_url.Contains('{') ? repositories[j].commits_url.Substring(0, findCharacter('{', repositories[j].commits_url)) : repositories[j].commits_url);
                            String jsonUsersInvolved = WebRequest(url + "?path=" + obj.path);
                            GitHubCommit[] tempCommit = (!String.IsNullOrEmpty(jsonUsersInvolved) ? JsonConvert.DeserializeObject<GitHubCommit[]>(jsonUsersInvolved) : new GitHubCommit[0]);

                            for (int l = 0; l < tempCommit.Length; l++)
                            {
                                if (tempCommit[l].committer != null && tempCommit[l].author != null)
                                {
                                    usernameUserInvolved.Add(tempCommit[l].author.login);
                                    usernameUserInvolved.Add(tempCommit[l].committer.login);
                                }
                            }

                            fileFounded.InvolvedUsers = usernameUserInvolved.Distinct().ToArray();

                            filesfounded.Add(fileFounded);
                        }
                    }
                    catch (NullReferenceException e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.Message);
                    }

                    collection.Uri = repositories[j].git_url;
                    collection.Files = filesfounded.ToArray();
                    collection.WorkItems = issuesfounded.ToArray();

                    collections.Add(collection);
                }
            }
            return collections.ToArray();
              /*
            List<GitHubObject> objects = new List<GitHubObject>();
            Dictionary<GitHubRepositories, List<GitHubObject>> dictionaryFiles = new Dictionary<GitHubRepositories, List<GitHubObject>>();

            Contract.Requires(!String.IsNullOrEmpty(_host));

            String jsonUser = WebRequest(_host + "user");
            GitHubUser currentUser;
            String jsonUserRepositories;
            GitHubRepositories[] publicRepositories;
            String jsonOrganizations;
            GitHubOrganization[] organizations;

            currentUser = (jsonUser !=  "" ? JsonConvert.DeserializeObject<GitHubUser>(jsonUser) : null);
            jsonUserRepositories = (currentUser != null ? WebRequest(currentUser.repos_url) : null);
            publicRepositories = ( jsonUserRepositories != null ? JsonConvert.DeserializeObject<GitHubRepositories[]>(jsonUserRepositories) : null);
            jsonOrganizations = (currentUser != null? WebRequest(currentUser.organizations_url) : null);
            organizations = (jsonOrganizations != null ? JsonConvert.DeserializeObject<GitHubOrganization[]>(jsonOrganizations) : null);
            */
            /*if (publicRepositories != null)
            {
                /* string url = ( publicRepositories[0].contents_url.Contains('{') ? publicRepositories[0].contents_url.Substring(0,findCharacter('{',publicRepositories[0].contents_url)) : publicRepositories[0].contents_url );
                 String jsonRootObjects = WebRequest(url);
                 GitHubObject[] tempObjects = ( jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : null);
                 if (tempObjects.Length > 0)
                 {
                     objects.AddRange(tempObjects);
                 }

                 for (int i = 0; i < objects.Count; i++)
                 {
                     getRepositoriesFiles(ref objects, objects[i],ref i);
                 }

                 dictionaryFiles.Add(publicRepositories[0], objects);

                 if (publicRepositories.Length > 1)
                 {*/
                /*     for (int i = 0; i < publicRepositories.Length; i++)
                     {
                         objects = new List<GitHubObject>();

                         string url = (publicRepositories[i].contents_url.Contains('{') ? publicRepositories[i].contents_url.Substring(0, findCharacter('{', publicRepositories[i].contents_url)) : publicRepositories[i].contents_url);
                         string jsonRootObjects = WebRequest(url);
                         GitHubObject[] tempObjects = (jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : new GitHubObject[0]);
                         if (tempObjects.Length > 0)
                         {
                             objects.AddRange(tempObjects);
                         }

                         for (int j = 0; j < objects.Count; j++)
                         {
                             getRepositoriesFiles(ref objects, objects[j], ref j);
                         }

                         dictionaryFiles.Add(publicRepositories[i], objects);
                     }
                 }

            if(organizations != null)
            {
                for (int i = 0; i < organizations.Length; i++)
                {
                    string url = (organizations[i].repos_url.Contains('{') ? organizations[i].repos_url.Substring(0, findCharacter('{', organizations[i].repos_url)) : organizations[i].repos_url);
                    String jsonOrgsRepositories = WebRequest(url);
                    GitHubRepositories[] repositories = (jsonOrgsRepositories != null && jsonOrgsRepositories != "" ? JsonConvert.DeserializeObject<GitHubRepositories[]>(jsonOrgsRepositories) : null);

                    if(repositories != null)
                    {
                        for (int j = 0; j < repositories.Length; j++)
                        {
                            objects = new List<GitHubObject>();
                            url = (repositories[j].contents_url.Contains('{') ? repositories[j].contents_url.Substring(0, findCharacter('{', repositories[j].contents_url)) : repositories[j].contents_url);
                            String jsonRootObjects = WebRequest(url);
                            GitHubObject[] tempObjects = ( jsonRootObjects != "" ? JsonConvert.DeserializeObject<GitHubObject[]>(jsonRootObjects) : new GitHubObject[0]);

                            if (tempObjects.Length > 0)
                            {
                                objects.AddRange(tempObjects);

                                for (int h = 0; h < objects.Count; h++)
                                {
                                    getRepositoriesFiles(ref objects, objects[h], ref h);
                                }
                            }
                            dictionaryFiles.Add(repositories[j], objects);

                        }
                    }

                }
            }

            List<SCollection> result = new List<SCollection>();

            foreach (KeyValuePair<GitHubRepositories, List<GitHubObject>> pair in dictionaryFiles)
            {
                SCollection collection= new SCollection();
                collection.Uri = pair.Key.git_url;
                List<SFile> filesFounded = new List<SFile>();
                List<GitHubObject> list = pair.Value;

                for (int i = 0; i < list.Count; i++)
                {
                    SFile fileFounded = new SFile();
                    List<string> usernameUserInvolved = new List<string>();
                    fileFounded.Name = list[i].path ;
                    String url = (pair.Key.commits_url.Contains('{') ? pair.Key.commits_url.Substring(0, findCharacter('{', pair.Key.commits_url)) : pair.Key.commits_url);
                    String jsonUsersInvolved = WebRequest(url + "?path="+ list[i].path);
                    GitHubCommit[] tempCommit = ( jsonUsersInvolved != null && !String.IsNullOrEmpty(jsonUsersInvolved)  ? JsonConvert.DeserializeObject<GitHubCommit[]>(jsonUsersInvolved) : new GitHubCommit[0]);

                    for (int j = 0; j < tempCommit.Length; j++)
                    {
                        if (tempCommit[j].committer != null && tempCommit[j].author != null)
                        {
                            usernameUserInvolved.Add(tempCommit[j].author.login);
                            usernameUserInvolved.Add(tempCommit[j].committer.login);
                        }
                    }

                    fileFounded.InvolvedUsers = usernameUserInvolved.Distinct().ToArray();

                    filesFounded.Add(fileFounded);
                }

                collection.Files = filesFounded.ToArray();

                //checking issues
                List<SWorkItem> issuesFounded = new List<SWorkItem>();
                string issues_url = pair.Key.issues_url;
                issues_url = (issues_url.Contains('{') ? issues_url.Substring(0, findCharacter('{', issues_url)) : issues_url);
                String jsonIssues = WebRequest(issues_url);
                GitHubIssue[] publicIssues = (jsonIssues != "" ? JsonConvert.DeserializeObject<GitHubIssue[]>(jsonIssues) : new GitHubIssue[0]);

                foreach (GitHubIssue issue in publicIssues)
                {
                    issuesFounded.Add(new SWorkItem() {
                        Name = issue.title,
                        InvolvedUsers = getUsersIssue(issue)
                    });
                }

                collection.WorkItems = issuesFounded.ToArray();
                result.Add(collection);

                System.Diagnostics.Debug.WriteLine("dizionario " + pair.Key.git_url);

            }

            return result.ToArray();*/
        }