private async ValueTask <(Subcategory subcategory, string error)> CreateSubcategory(SubcategoryDTO entityDTO, ICollection <Photo> defaultPhotoList = null, List <Photo> scheduleAddedPhotoList = null, List <Photo> scheduleDeletePhotoList = null) { var subcategory = new Subcategory() { CategoryId = entityDTO.NewCategoryId, SubcategoryId = entityDTO.Alias.TransformToId(), Alias = entityDTO.Alias, IsVisible = entityDTO.IsVisible ?? true, Description = entityDTO.Description, SeoTitle = entityDTO.SeoTitle, SeoDescription = entityDTO.SeoDescription, SeoKeywords = entityDTO.SeoKeywords, Products = new List <Product>(), Photos = new List <Photo>() }; //Добавляем и проверяем можем ли мы добавить данную категорию var(isSuccess, error) = await _repository.AddSubcategory(subcategory); if (!isSuccess) { return(null, error); } _photoEntityUpdater.MovePhotosToEntity(subcategory, defaultPhotoList); await _photoEntityUpdater.LoadPhotosToEntity(subcategory, entityDTO, scheduleAddedPhotoList, scheduleDeletePhotoList); await _context.SaveChangesAsync(); return(subcategory, null); }