private IList <GitRepositoryDto> GetUserRepository(string username)
        {
            var repository = new List <GitRepositoryDto>();

            var repoResult = GitService.GetGitUserRepositories(new GetGitRepositoriesRequest()
            {
                Username = username
            });

            if (repoResult.IsNull() || repoResult.Repositories.IsNull())
            {
                Logger.Error("The repository result returned was null. Username - {0}".FormatInvariantCulture(username));
                Notifications.AddError(Errors.GetGitRepositoryError.FormatInvariantCulture(username));
            }

            if (!Notifications.HasErrors())
            {
                repository = OrderByStargazers(repoResult.Repositories);
            }

            return(repository);
        }
        private GitUserDto GetGitUser(string username)
        {
            var user       = new GitUserDto();
            var userResult = GitService.GetGitUser(new GetGitUserRequest(username));

            if (userResult.IsNull() || userResult.User.IsNull())
            {
                Logger.Error("The user returned by the git service was null. Username - {0}".FormatInvariantCulture(username));
                Notifications.AddError(Errors.GetGitUserError.FormatInvariantCulture(username));
            }

            if (!Notifications.HasErrors())
            {
                user = userResult.User;
            }

            if (!Notifications.HasErrors() && !userResult.IsValid())
            {
                Notifications.AddMessage(new Notification(Messages.NoUserFound.FormatInvariantCulture(username)));
            }

            return(user);
        }
 protected override void RunPreSaveValidationCore()
 {
     Notifications.AddError("Cannot save an empty soul - Please change the soul type");
     base.RunPreSaveValidationCore();
 }