private void GetLatest() throws Exception { // clear the bookmarks table... getDatabase().ExecuteNonQuery(new SqlStatement("delete from bookmarks"), true); // get the bookmarks from the server... BookmarksService service = new BookmarksService(); for (Bookmark bookmark : service.GetAll()) { // the bookmarks we get from the server have server ids populated. we need to // remove the server id and save locally by creating a new item... // create and copy all of the fields except the key field... Bookmark newBookmark = new Bookmark(); for (EntityField field : getEntityType().getFields()) { if (!(field.getIsKey()) && bookmark.getIsLoaded(field)) newBookmark.SetValue(field, bookmark.GetValue(field), SetReason.UserSet); } // set local modified and deleted... newBookmark.setLocalModified(false); newBookmark.setLocalDeleted(false); // save... newBookmark.SaveChanges(this.getContextSource()); } }