Factored out some common code between the deletion and insertion mutation operators.