Remove some CommandItems code duplication.