Refactor New diagram command handler