Moved duplicated code to private method