Managing Conversation History Across Multiple Threads in OpenAI with C#

How can I connect previous threads when creating a new thread in OpenAI’s API using C#? My goal is to append the last few messages from the previous thread to the new one to maintain conversation history. I’m storing user inputs and responses in Cosmos DB and fetching the latest four messages whenever a new thread is created. Each new user input generates a new thread, and I need to ensure that the previous context is carried over by adding those last four messages to the newly created thread. What is the best way to manage this process efficiently in C# while handling multiple threads and keeping the conversation flow intact?