implemented category management with ancestors rebuild