Could you implement a unit test for this method (that now implements a more complex logic)?