I have a really weird behavior which I cannot explain.
I have the following class:
public class Project { public virtual int Id { get; set; }
You are comparing two different objects that hold the same data. You should overload Equals method in your Project class, and implement comparison by id there.