protected void LogIntoDB(string SearchFor, MovieSearchResult result) { var search = DBSRLOG.AddEditSearch( new Entities.Search { SearchFor = SearchFor, Response = result.Response, TotalRecords = result.TotalResults }); if (search != null && result.Search.Count > 0) { if (search.Id > 0) { foreach (var item in result.Search) { DBSRLOG.AddEditSearchResult( new Entities.SearchResult { Search = search, imdbID = item.imdbID, Poster = item.Poster, Title = item.Title, Type = item.Type, Year = item.Year } ); } } } }