private string GetKey() { while (true) { string key = SerialKey.Generate().ToUpper(); if (!_context.Licenses.Any(l => l.Key == key)) { return(key); } } }