Extracts a block to a method and replaces its usage with a method reference.