public Task CheckMailBox() { if (MailBox.Count == 0) { return(Task.CompletedTask); } IMessage data; if (!MailBox.TryDequeue(out data)) { return(Task.CompletedTask); } if (data is IncreaseCount) { IncreaseCounter(data as IncreaseCount); } return(Task.CompletedTask); }