public async Task RevokeAsync(DomainAuthorization authorization)
        {
            Ensure.NotNull(authorization, nameof(authorization));

            await db.DomainAuthorizations.PatchAsync(authorization.Id, new[] {
                Change.Replace("revoked", Expression.Func("NOW"))
            }, condition : Expression.IsNull("revoked"));
        }
        public async Task CompleteAsync(DomainAuthorization authorization, DateTime expires)
        {
            Ensure.NotNull(authorization, nameof(authorization));

            await db.DomainAuthorizations.PatchAsync(authorization.Id, new[] {
                Change.Replace("completed", Expression.Func("NOW")),
                Change.Replace("expires", expires),
            }, condition : Expression.IsNull("completed"));
        }
        public async Task <DomainAuthorization> CreateAsync(CreateDomainAuthorizationRequest request)
        {
            Ensure.NotNull(request, nameof(request));

            var id = await DomainAuthorizationId.NextAsync(db.Context, request.DomainId);

            var authorization = new DomainAuthorization(id, request.Type, request.Properties);

            await db.DomainAuthorizations.InsertAsync(authorization);

            return(authorization);
        }