Fixed the fact that when trying to update a custom field in an issue a PHP error gets generated.

Previously, the code would loop through all key-value pairs and try to attach the value as a string.

When hitting key='custom_fields' it would encounter an array as the value and this would fail.

There was existing additional logic to deal with this scenario when creating a new issue, but
not when updating an old one.

I have moved the code from create() that generates the XML into into its own function, and then
called this function from create() and update(). This seems to fix the issue.