public async Task <Result> Handle(DeletePageCommand request, CancellationToken token) { var legal = await _context.Legals .SingleOrDefaultAsync(r => r.Documents.Any(d => d.Id == request.DocumentId), token); var document = legal.Documents.FirstOrDefault(d => d.Id == request.DocumentId); var deleteResult = await _blobService.DeleteDocumentPageAsync(document.Id, request.PageId, legal.User.Id, token); if (!deleteResult.Succeeded) { return(Failure(deleteResult)); } document.DeletePage(request.PageId); await _context.SaveChangesAsync(token); return(Success()); }