Can u tell me what is the problem?
If you are using two different instances of the
db variable as you named it) then nothing will be saved when you call
SaveChanges on a context different than the one where your entities are tracked. You need to use the Attach method first.
However I think in your case you can avoid the attach step if you refactor a bit you code and don't use the DbContext from the entity itself.