private Person GetPerson(Person g) { var person = _entities.People.Where(o => o.ImdbId == g.ImdbId).FirstOrDefault(); if (person == null) { person = new Person { Name = g.Name, ImdbId = g.ImdbId }; _entities.AddToPeople(person); _entities.SaveChanges(); } return(person); }