Extracted redundant code into method.