internal string GetPublishingUser()
        {
            if (!string.IsNullOrEmpty(PublishingUsername))
            {
                return(PublishingUsername);
            }

            // Get publishing users
            IList <string> users = null;

            try
            {
                users = WebsitesClient.ListPublishingUserNames();
            }
            catch
            {
                throw new Exception(Resources.NeedPublishingUsernames);
            }

            if (users.Count == 0)
            {
                throw new ArgumentException(Resources.InvalidGitCredentials);
            }

            if (users.Count != 1)
            {
                throw new Exception(Resources.MultiplePublishingUsernames);
            }

            return(users.First());
        }