private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (this.lastSubscribedAccountId.HasValue)
                    {
                        try
                        {
                            Task.Run(() => this.UnsubscribeToUpdates(this.lastSubscribedAccountId.Value));
                        }
                        catch (Exception e)
                        {
                            Logger.DisplayError("Account " + this.lastSubscribedAccountId.Value + " failed to unsubscribe from updates", e);
                        }
                    }

                    if (this.clientAccountApi != null)
                    {
                        ApiAccessor.Dispose(this.clientAccountApi);
                    }
                }

                this.disposed = true;
            }
        }