This repeating code should be moved to separate method.