Hi @omer.alumur , despite this being solved I can just recommend using already written code:
Should do what you want
Best regards Michael