public Group GroupCreate(Guid? guid, string name, Guid requestedUserGuid, uint systemPermission )
{
guid = guid ?? Guid.NewGuid();
var result = Gateway.ExecuteNonQuery("Group_Create", new[]
{
new MySqlParameter("Guid", guid.Value.ToByteArray()),
new MySqlParameter("Name", name),
new MySqlParameter("RequestUserGuid", requestedUserGuid.ToByteArray()),
new MySqlParameter("SystemPermission", systemPermission)
});
if (result == -100) throw new InsufficientPermissionsException("User has insufficient permissions to create groups");
if (result == -200) throw new UnhandledException("Group_Create had an unhandled exception and was rolled back");
return GroupGet(guid, null, null, null).First();
}