@brunocoelho to avoid duplication, could you please put this piece of code in a reusable function?