Command trait and helper functions.
This trait implements a command with optional event/query operations.