public static function deleteRoleData($id)
 {
     $role = RoleRepository::getRole($id);
     //check if users are assigned to this role, if not delete role else error (to avoid cascade delete)
     $affiliatedUsers = UserRepository::getAffiliatedToCount("role_id", $id);
     if ($affiliatedUsers > 0) {
         Session::flash('warning', 'Cannot delete role, Users are assigned to it');
         return Redirect::to("/system/roles")->send();
     }
     //check if permissions are assigned to this role, if not delete role else error (to avoid cascade delete)
     $affiliatedPermissions = PermissionRepository::getAffiliatedToCount("role_id", $id);
     if ($affiliatedPermissions > 0) {
         Session::flash('warning', 'Cannot delete role, Permissions are assigned to it');
         return Redirect::to("/system/roles")->send();
     }
     $role->delete();
     Session::flash('message', 'Role deleted');
     return Redirect::to("/system/roles")->send();
 }