protected override async Task HandleCore(TriageDataLockCommand message)
        {
            var validationResult = _validator.Validate(message);

            if (!validationResult.IsValid)
            {
                throw new ValidationException(validationResult.Errors);
            }

            var dataLock = await _dataLockRepository.GetDataLock(message.DataLockEventId);

            AssertDataLockBelongsToApprenticeship(message.ApprenticeshipId, dataLock);

            var triageStatus = (TriageStatus)message.TriageStatus;

            if (dataLock.TriageStatus == triageStatus)
            {
                _logger.Warn($"Trying to update data lock for apprenticeship: {message.ApprenticeshipId} with the same TriageStatus ({message.TriageStatus}) ");
                return;
            }

            AssertValidTriageStatus(triageStatus, dataLock);
            await AssertNoPendingApprenticeshipUpdate(dataLock, message.ApprenticeshipId);

            await _dataLockRepository.UpdateDataLockTriageStatus(message.DataLockEventId, triageStatus);
        }
        public async Task <GetDataLockResponse> Handle(GetDataLockRequest message)
        {
            var validationResult = _validator.Validate(message);

            if (!validationResult.IsValid)
            {
                throw new ValidationException(validationResult.Errors);
            }

            var data = await _dataLockRepository.GetDataLock(message.DataLockEventId);

            AssertDataLockBelongsToApprenticeship(message.ApprenticeshipId, data);

            return(new GetDataLockResponse
            {
                Data = data
            });
        }