public ValidationResult Validate(OutlookContext context, int id, string email) { Addresses.Clear(); if (Emails.Length == 0) { return(new ValidationResult("Error: No addresses provided!")); } if (GroupName.Length == 0) { return(new ValidationResult("Error: No Group Name provided!")); } if (GroupName.StartsWith("g:")) { return(new ValidationResult("Error: Invalid Group Name, start with 'g:' is not allowed")); } if (GroupName.Contains(";")) { return(new ValidationResult("Error: Invalid Group Name, using ';' is not allowed")); } if (context.Groups.Where(g => g.GroupName == GroupName && g.OwnerId == id).ToList().Count > 0) { return(new ValidationResult("Error: Invalid Group Name, you have already group with the same name")); } string[] EmailsTab = Emails.Split(';'); (bool dis1, ValidationResult v1) = CheckExistence(context, id, email, EmailsTab, "Error in group members", 0); if (v1 != ValidationResult.Success) { return(v1); } return(ValidationResult.Success); }