Code Refactoring (Replace Command Pattern with Service-Based Pattern)