public static string CreateGroup(String GroupName) { string group_title = GroupName; if (!Regex.IsMatch(group_title, @"^[a-zA-Z]+$") || group_title.Length < 4 || !UniquieGroup(group_title)) { return("no match format"); } using (chatEntities context = new chatEntities()) { group groups = new group { title = group_title, }; context.groups.Add(groups); context.SaveChanges(); } return("added succesfully"); }