private async Task <List <Video> > GenerateVideos(List <User> users, List <VideoCategory> videoCategories, int range) { var videos = new List <Video>(); for (var videoCount = 1; videoCount < range; videoCount++) { var user = new Video() { Id = Guid.NewGuid().ToString(), VideoCategoryId = videoCategories.ElementAt(_random.Next(videoCategories.Count())).Id, UrlAddress = "", UserId = users.ElementAt(_random.Next(users.Count())).Id, Name = _helper._videoName + _helper.GetRandomString(), Description = _helper._descriptionName + _helper.GetRandomString() }; Context.Add(user); videos.Add(user); } await Context.SaveChangesAsync(); return(videos); }