public void SendEventMessage(Profile profile, Recipe recipe) { EventMessage msg = new EventMessage(); msg.To = profile.NickName; msg.From = "*****@*****.**"; msg.Topic = "New Recipes from" + recipe.Tag; msg.Content = _linkGenerator.GenerateRecipeLink(recipe.Id); _IMrepo.Insert(msg); _Lgrepo.Insert(new LogRecord { Message = _mapper.MapMail(msg), Status = "Succeed" }); _IMrepo.SaveChanges(); _Lgrepo.SaveChanges(); }