refactor handling of InvocationExpressions and add new utility method
for backend