refactor attachment schema