How to handle accessing a disposed object issue in ASP.NET Core applications?