You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: apigw_filter.go
    path of file: ./repos/corteza/server/system/service
    
    the code of the file until where you have to start completion: package service

import (
	"context"

	"github.com/cortezaproject/corteza/server/pkg/actionlog"
	"github.com/cortezaproject/corteza/server/pkg/apigw"
	agtypes "github.com/cortezaproject/corteza/server/pkg/apigw/types"
	a "github.com/cortezaproject/corteza/server/pkg/auth"
	"github.com/cortezaproject/corteza/server/pkg/filter"
	"github.com/cortezaproject/corteza/server/store"
	"github.com/cortezaproject/corteza/server/system/types"
)

type (
	apigwFilter struct {
		actionlog actionlog.Recorder
		store     store.Storer
		ac        routeAccessController
		route     *apigwRoute
	}
)

func Filter() *apigwFilter {
	return &apigwFilter{
		route:     DefaultApigwRoute,
		ac:        DefaultAccessControl,
		actionlog: DefaultActionlog,
		store:     DefaultStore,
	}
}
    
func (svc *apigwFilter) UndeleteByID(ctx context.Context, ID uint64) (err error) {
	var (
		qProps = &apigwFilterActionProps{}
		q      *types.ApigwFilter
		r      *types.ApigwRoute
	)

	err = func() (err error) {
		if q, err = store.LookupApigwFilterByID(ctx, svc.store, ID); err != nil {
			return ApigwFilterErrNotFound(qProps)
		}

		if r, err = store.LookupApigwRouteByID(ctx, svc.store, q.Route); err == store.ErrNotFound {
			return ApigwRouteErrNotFound()
		} else if err != nil {
			return
		}

		if !svc.ac.CanDeleteApigwRoute(ctx, r) {
			return ApigwRouteErrNotAllowedToUndelete()
		}

		qProps.setFilter(q)

		q.DeletedAt = nil
		q.UpdatedBy = a.GetIdentityFromContext(ctx).Identity()

		if err = store.UpdateApigwFilter(ctx, svc.store, q); err != nil {
			return
		}

		// send the signal to reload current route
		if r.Enabled {
			if err = apigw.Service().ReloadEndpoint(ctx, r.Method, r.Endpoint); err != nil {
				return err
			}
		}

		return nil
	}()

	return svc.recordAction(ctx, qProps, ApigwFilterActionDelete, err)
}