[Refactoring] Extract code into a separate method
[Refactoring] Move nested try..catch up one level