I've moved the function to a slightly higher level because IMO this was clobbering the findByPhoneNumber callback and it was quite difficult to follow the code.