Fixing ArrayIndexOutOfBoundsException while saving allergies