fixed a bug in REST in create new resource with Array. Some refactoring. Fixes on REST test.