static void LogQuery(LogsContext context, string queryXml) { SearchLog newLog = new SearchLog(); newLog.Date = DateTime.Now; newLog.QueryXml = queryXml; context.SearchLogs.Add(newLog); context.SaveChanges(); }