refactoring CommandAdd and CommandDelete