Remove duplicated code as per scrutinizer issue