As Dean Ward suggested in his comment, you could instead use a GUID as your activation key.
An example of how this could be done is as follows:
private string CreateActivationKey()
{
var activationKey = Guid.NewGuid().ToString();
var activationKeyAlreadyExists =
mobileDeviceService.GetActivationKeys().Any(key => key == activationKey);
if (activationKeyAlreadyExists)
{
activationKey = CreateActivationKey();
}
return activationKey;
}
I've used "GetActivationKeys" to keep my solution in-line with your "GetAll" method; However I'd probably implement a method to perform a database query to check for the existence of a key (bringing back all the activation keys to your service is not the most performant solution).
The likelihood of generating a duplicate GUID is very low. A nice article about GUIDs is here.