public async Task <CreatedTask> CreateAsync(CreateTask model, IValidator <CreateTask> validator) { ValidateAndThrow(model, validator); var task = _mapper.Map <ToDoTask>(model); task.Name = task.Name.Trim(); if (!_listService.IsShared(task.ListId, model.UserId)) { task.PrivateToUserId = null; task.AssignedToUserId = null; } task.Order = 1; task.CreatedDate = task.ModifiedDate = DateTime.UtcNow; task.Id = await _tasksRepository.CreateAsync(task, model.UserId); var result = _mapper.Map <CreatedTask>(task); return(result); }