public override AccountNrOfContactsSetEvent Execute(SetAccountNrOfContactsCommand command) { command.FromContact = command.FromContact ?? throw new ArgumentNullException(nameof(command.FromContact)); if (command.FromContact.ParentCustomerId == null) { return(null); } int nrOfContacts = accountQueries.GetNrOfContacts(command.FromContact.ParentCustomerId.Id); Account account = new Account { Id = command.FromContact.ParentCustomerId.Id, Name = $"I have {nrOfContacts} contacts" }; OrgServiceWrapper.OrgServiceAsSystem.Update(account); return(new AccountNrOfContactsSetEvent { TargetContact = command.FromContact }); }