You can use any AI tool like microsoft copilot, git hub copilot etc give some  context and both the copilot give you good solution. I tried both and both are providing required solution.