#1078 Logic moved from controller to the command