Or perhaps @amshali could extract this part of the logic from his code to a re-usable helper function you could both use, to keep it "DRY".