Refactored similar array append activities into array_append().