This is what I have and it keeps returning null.
It doesn\'t recognize the Convert.toInt32 when I add a where statement
var maxTopID = (from max in
Check for the null condition as mentioned in below query
var maxTopID = (from max in dbcontext.Topics.Local where max.TopicId != null select max.TopicID).Max();