private void ValidateTypingActivity(IActivity obj) { var activity = obj.AsTypingActivity(); if (activity != null) { return; } throw new Exception("Activity was not of type TypingActivity"); }