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: events.go
    path of file: ./repos/gitness/app/services/webhook
    
    the code of the file until where you have to start completion: // Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the 
    
func (s *Service) findRepositoryForEvent(ctx context.Context, repoID int64) (*types.Repository, error) {
	repo, err := s.repoStore.Find(ctx, repoID)

	if err != nil && errors.Is(err, store.ErrResourceNotFound) {
		// not found error is unrecoverable - most likely a racing condition of repo being deleted by now
		return nil, events.NewDiscardEventErrorf("repo with id '%d' doesn't exist anymore", repoID)
	}
	if err != nil {
		// all other errors we return and force the event to be reprocessed
		return nil, fmt.Errorf("failed to get repo for id '%d': %w", repoID, err)
	}

	return repo, nil
}