Refactor long methods in iText