Designing a business automated task and trying to optimize the queries performed to the database - C#