public void Publish(Command command) { var commandType = command.GetType(); if (commandType == typeof(Start)) Publish((Start)command); if (commandType == typeof(Stop)) Publish((Stop)command); }