if (startTime != null) { startTime = startTime.Value.Date.ToUniversalTime(); query = query.Where(p => p.CreatedOnUtc >= startTime); }
if (endTime != null)
{
endTime = endTime.Value.AddDays(1).Date.ToUniversalTime(); query = query.Where(p => p.CreatedOnUtc < endTime);
}