I don't like the duplicated code here and in return, could we maybe move it to a method that both of these call?