private void SeedPositions(IEnumerable <EmployeeDto> employees) { foreach (var employee in employees) { var positionName = employee.Position.Name; var containsPosition = this.positions.Local.Where(p => p.Name == positionName).Any(); if (!containsPosition) { var position = new Position() { Name = positionName }; this.positions.Add(position); } } data.SaveChanges(); }