Fix for array of hashes with nested attributes, should refactor