Added parent id conditional for subcategory