public static void SetValue(this ICollection <Claim> claims, string type, string value) { if (claims == null) { throw new ArgumentNullException("type"); } if (String.IsNullOrWhiteSpace(type)) { throw new ArgumentNullException("type"); } claims.RemoveClaim(type); if (!String.IsNullOrWhiteSpace(value)) { claims.AddClaim(type, value); } }