public static SecurityCode For(string code) { var securityCode = new SecurityCode(); try { if (code.Length != 3 || !int.TryParse(code, out _)) { throw new SecurityCodeInvalidException(code, null); } securityCode.Code = code; } catch (Exception ex) { throw new SecurityCodeInvalidException(code, ex); } return(securityCode); }