[NEXUS-5214] Drop duplicated code

Signed-off-by: Alin Dreghiciu <adreghiciu@gmail.com>