Fixed Error: undefined method `[]' for nil:NilClass

This error is similar to what is the problem in https://github.com/theforeman/hammer-cli-foreman/pull/90 with the only difference that there is no rescue which hides the error.

Removed the nesting to solve the issue.