private EMailRM CreateEMailForAssociate(Commands.V1.Associate.EMail.CreateForAssociate cmd) { EMail email = EMail.CreateForAssociate(_emails++, EMailAddress.Create(cmd.EMailAddress), cmd.IsPrimary, cmd.AssociateId); if (_repository.EMailExistsForAssociate(email, cmd.AssociateId)) { throw new InvalidOperationException($"EMail already exists for Associate {cmd.AssociateId}"); } _repository.AddEMailForAssociate(email, cmd.AssociateId); return(Conversions.GetEMailRM(email)); }