refactoring to DDD