private Task <ExcelManager> CreateExcel() { return(Task.Run(() => { var excelManager = new ExcelManager(); excelManager .AddTable(CodeResources.Temperature, Boiler.Measurments.Select(x => x.DateTime.ToString()), Boiler.Measurments.Select(x => x.Temperature)) .AddTable(CodeResources.Level, Boiler.Measurments.Select(x => x.DateTime.ToString()), Boiler.Measurments.Select(x => x.Level)); if (Boiler.Template != null) { foreach (var key in Boiler.Template) { var measurments = Boiler.Measurments.Where(x => x.Values != null && x.Values.ContainsKey(key)); excelManager.AddTable(key, measurments.Select(x => x.DateTime.ToString()), measurments.Select(x => x.Values[key])); } } return excelManager; })); }