public function removeCostNgAction($cost_id)
 {
     $em = $this->getDoctrine()->getManager();
     $response = new Response(json_encode(array("result" => Cost::removeCostById($em, $cost_id))));
     $response->headers->set('Content-Type', 'application/json');
     return $response;
 }
 public static function removeCostCategoryById($em, $id)
 {
     $costCategory = $em->getRepository("RenovateMainBundle:CostCategory")->find($id);
     foreach ($costCategory->getCosts() as $cost) {
         Cost::removeCostById($em, $cost->getId());
     }
     $em->remove($costCategory);
     $em->flush();
     return true;
 }