❔ How optimize this code without breaking it and taking DRY into account? - C#