/// <summary>
        /// Updates the current project data from the given <paramref name="project"/>.
        /// </summary>
        public void UpdateCurrentProject(Project project)
        {
            if (project?.ProjectId != CurrentProjectId)
            {
                CurrentProjectId        = project?.ProjectId;
                CurrentProjectNumericId = project?.ProjectNumber.ToString();

                UpdateDefaultCredentials();
                CurrentProjectIdChanged?.Invoke(this, EventArgs.Empty);
            }
        }
        /// <summary>
        /// Updates the current account for the extension.
        /// This method will also invalidate the project.
        /// It is up to the caller to select an appropriate one.
        /// </summary>
        public void UpdateCurrentAccount(IUserAccount account)
        {
            if (CurrentAccount?.AccountName != account?.AccountName)
            {
                CurrentAccount          = account;
                CurrentProjectId        = null;
                CurrentProjectNumericId = null;

                UpdateDefaultCredentials();

                CurrentAccountChanged?.Invoke(this, EventArgs.Empty);
                CurrentProjectIdChanged?.Invoke(this, EventArgs.Empty);
            }
        }
        /// <summary>
        /// Resets the credentials state to the account with the given <paramref name="accountName"/> and the
        /// given <paramref name="projectId"/>.
        /// If <paramref name="accountName"/> cannot be found in the store then the credentials will be reset
        /// to empty.
        /// </summary>
        /// <param name="accountName">The name of the account to make current.</param>
        /// <param name="projectId">The projectId to make current.</param>
        public void ResetCredentials(string accountName, string projectId)
        {
            IUserAccount newCurrentAccount = GetAccount(accountName);

            if (newCurrentAccount != null)
            {
                CurrentAccount          = newCurrentAccount;
                CurrentProjectId        = projectId;
                CurrentProjectNumericId = null;
            }
            else
            {
                Debug.WriteLine($"Unknown account: {accountName}");
                CurrentAccount          = null;
                CurrentProjectId        = null;
                CurrentProjectNumericId = null;
            }

            UpdateDefaultCredentials();

            CurrentAccountChanged?.Invoke(this, EventArgs.Empty);
            CurrentProjectIdChanged?.Invoke(this, EventArgs.Empty);
        }