public void OnItemTap(SearchResultVM result) { if (result.IsLocked) { Navigate.ToBuyNowPage(); return; } FoodItem item = null; try { item = result.MakeItem() as FoodItem; } catch (Exception ex) { LittleWatson.ReportException(ex); } if (item == null) { return; } bool WasNew = item.IsNewItem; int i = 0; try { if (Results != null) { for (int j = 0; j < Results.Count; j++) { if (Results[j] == result) { i = j; } } } } catch (Exception ex) { LittleWatson.ReportException(ex); } TraceQuery(true, true); SessionLog.RecordNewEntry(item.Text, result.GetType().Name, Query, LastQuery, i); Entry entry = new Entry(Navigate.selectedDate, Navigate.selectedPeriod, item); if (WasNew) { Navigate.ToEntryDetail(entry); } else { if (Navigate.IAcceptsNewEntry != null) { if (!Navigate.IAcceptsNewEntry.ShouldSaveNewEntry(entry)) { Navigate.BackFromSearch(); return; } } entry.Save(); MessageQueue.Push(new EntryUpdatedMessage(entry)); //Cache.AddEntry(entry); // <-- the double entry bug!!! Navigate.BackFromSearch(); } }