/// <summary>
        /// Get all users associated to the issue
        /// </summary>
        /// <param name="issue"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        private string[] getUsersIssue(GitHubIssue issue, GitHubUser user)
        {
            Contract.Ensures(issue != null);
            Contract.Ensures(user != null);

            List<string> usersfounded = new List<string>();

            if (!issue.user.id.Equals(user.id))
            {
                usersfounded.Add(issue.user.login);
            }
            else if ( issue.assignee != null &&  !issue.assignee.id.Equals(user.id))
            {
                usersfounded.Add(issue.assignee.login);
            }
            else
            {
                if (issue.comments > 0)
                {
                    string url = (issue.comments_url.Contains('{') ? issue.comments_url.Substring(0, findCharacter('{', issue.comments_url)) : issue.comments_url);
                    String jsonComments = WebRequest(url);
                    GitHubComments[] comments = JsonConvert.DeserializeObject<GitHubComments[]>(jsonComments);

                    foreach (GitHubComments comment in comments)
                    {
                        if (!comment.user.id.Equals(user.id))
                        {
                            usersfounded.Add(comment.user.login);
                        }
                    }
                }
            }

            return usersfounded.Distinct().ToArray();
        }
        private string[] getUsersIssues(String  issues_url, GitHubUser currentUser)
        {
            List<string> userInWorkItem = new List<string>();

            if (!VerifyFilters())
            {
                string url = (issues_url.Contains('{') ? issues_url.Substring(0, findCharacter('{', issues_url)) : issues_url);
                String jsonIssues = WebRequest(url);
                GitHubIssue[] publicIssues =  ( jsonIssues != "" ? JsonConvert.DeserializeObject<GitHubIssue[]>(jsonIssues) : null);

                if (publicIssues != null && publicIssues.Length > 0)
                {

                    foreach (GitHubIssue issue in publicIssues)
                    {

                            if (AnalyzeIssue(issue, currentUser))
                            {
                                userInWorkItem.AddRange(getUsersIssue(issue, currentUser));
                            }

                    }
                }

            }
            else
            {
                String[] filters = ServiceFactory.GitHubLabels.Split(',');

                string url = (issues_url.Contains('{') ? issues_url.Substring(0, findCharacter('{', issues_url)) : issues_url);
                String jsonIssues = WebRequest(url);
                GitHubIssue[] publicIssues = ( jsonIssues != "" ? JsonConvert.DeserializeObject<GitHubIssue[]>(jsonIssues) : null);

                if (publicIssues != null && publicIssues.Length > 0)
                {

                    foreach (GitHubIssue issue in publicIssues)
                    {
                        Boolean flag = false;

                        for (int i = 0; i < filters.Length; i++)
                        {
                            foreach (GitHubLabelFounded label in issue.labels)
                            {
                                if (label.name.Equals(filters[i].ToString()))
                                {
                                    flag = true;
                                }
                            }
                        }

                        if (AnalyzeIssue(issue, currentUser) && flag)
                        {
                            userInWorkItem.AddRange(getUsersIssue(issue, currentUser));
                        }

                    }
                }

                //scan closed issues

                jsonIssues = WebRequest(url + "?state=closed");
                publicIssues = ( jsonIssues != "" ? JsonConvert.DeserializeObject<GitHubIssue[]>(jsonIssues) : null);

                if (publicIssues != null && publicIssues.Length > 0)
                {

                    foreach (GitHubIssue issue in publicIssues)
                    {
                        Boolean flag = false;

                        for (int i = 0; i < filters.Length; i++)
                        {

                                if ( VerifyLabelContain(filters[i],issue.labels))
                                {
                                    flag = true;
                                }

                        }

                        if (AnalyzeIssue(issue, currentUser) && flag)
                        {
                            userInWorkItem.AddRange(getUsersIssue(issue, currentUser));
                        }

                    }
                }

            }
            return userInWorkItem.Distinct().ToArray();
        }
        /// <summary>
        /// Check if the issue is connected with user.
        /// An issue is connected with a user if it has been created,commented or assigned to the user
        /// </summary>
        /// <param name="issue"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        private Boolean AnalyzeIssue(GitHubIssue issue, GitHubUser user)
        {
            Contract.Ensures(issue != null);
            Contract.Ensures(user != null);

            Boolean flag = false;
            if (issue.user.id.Equals(user.id))
            {
                flag = true;
            }
            else if (issue.assignee != null && issue.assignee.id.Equals(user.id))
            {
                flag = true;
            }
            else
            {
                if (issue.comments > 0)
                {
                    string url = (issue.comments_url.Contains('{') ? issue.comments_url.Substring(0, findCharacter('{', issue.comments_url)) : issue.comments_url);
                    String jsonComments = WebRequest(url);
                    GitHubComments[] comments = ( jsonComments != ""? JsonConvert.DeserializeObject<GitHubComments[]>(jsonComments) : new GitHubComments[0]);
                    Boolean flag_comments = false;

                    foreach (GitHubComments comment in comments)
                    {
                        if (comment.user.id.Equals(user.id))
                        {
                            flag_comments = true;
                        }
                    }

                    if (flag_comments)
                    {
                        flag = true;
                    }

                }
            }

            return flag;
        }