this method - doDayBegin(item.BranchId) is taking long time to execute. So I am using Parallel.ForEach to execute it parallel. When I am using norm
HttpContext.Current is set per thread. So when you fire up more threads using Parallel.ForEach your new threads can't access it that way. The solution would be to pass the needed values as parameters all the way instead of relying on HttpContext.Current in your repositories.
There are several sources here on SO that covers this problem already.
The cross-thread usage of "HttpContext.Current" property and related things
HttpContext.Current.Items in different thread
Access HttpContext.Current from different threads