public async Task <int> Create <TModel>(TModel model) { var query = new EnumerableQuery <TModel>(new[] { model }); var task = query.To <TraineeTask>().SingleOrDefault(); await this.taskRepository.AddAsync(task); await this.taskRepository.SaveChangesAsync(); // ReSharper disable once PossibleNullReferenceException return(task.Id); }