public MailMessage[] GetMessages(IEmailMessage emailMessage) { if (emailMessage is ProductQuestionMessage) { return(GetProductQuestionTypeofMessages(emailMessage)); } if (emailMessage is NewsletterMessage) { return(GetNewsletterTypeofMessages(emailMessage)); } throw new UnknownEmailMessageType(emailMessage.GetType()); }