@Override
  public Feature addFeature(Feature feature) throws FeatureManagementException {
    try {
      PolicyManagementDAOFactory.beginTransaction();
      feature = featureDAO.addFeature(feature);
      PolicyManagementDAOFactory.commitTransaction();

    } catch (PolicyManagerDAOException e) {
      try {
        PolicyManagementDAOFactory.rollbackTransaction();
      } catch (PolicyManagerDAOException e1) {
        log.warn("Unable to roll back the transaction");
      }
      String msg = "Error occurred while adding feature (" + feature.getName() + ")";
      log.error(msg, e);
      throw new FeatureManagementException(msg, e);
    } catch (FeatureManagerDAOException e) {
      try {
        PolicyManagementDAOFactory.rollbackTransaction();
      } catch (PolicyManagerDAOException e1) {
        log.warn("Unable to roll back the transaction");
      }
      String msg = "Error occurred while adding feature (" + feature.getName() + ")";
      log.error(msg, e);
      throw new FeatureManagementException(msg, e);
    }
    return feature;
  }
 @Override
 public boolean deleteFeature(Feature feature) throws FeatureManagementException {
   boolean bool;
   try {
     PolicyManagementDAOFactory.beginTransaction();
     bool = featureDAO.deleteFeature(feature.getId());
     PolicyManagementDAOFactory.commitTransaction();
   } catch (FeatureManagerDAOException e) {
     try {
       PolicyManagementDAOFactory.rollbackTransaction();
     } catch (PolicyManagerDAOException e1) {
       log.warn("Unable to roll back the transaction");
     }
     String msg = "Error occurred while deleting the feature (" + feature.getName() + ")";
     log.error(msg, e);
     throw new FeatureManagementException(msg, e);
   } catch (PolicyManagerDAOException e) {
     try {
       PolicyManagementDAOFactory.rollbackTransaction();
     } catch (PolicyManagerDAOException e1) {
       log.warn("Unable to roll back the transaction");
     }
     String msg =
         "Error occurred while deleting the feature (" + feature.getName() + ") from database";
     log.error(msg, e);
     throw new FeatureManagementException(msg, e);
   }
   return bool;
 }
 public static MobileFeature convertToMobileFeature(Feature feature) {
   MobileFeature mobileFeature = new MobileFeature();
   mobileFeature.setName(feature.getName());
   mobileFeature.setCode(feature.getCode());
   mobileFeature.setDescription(feature.getDescription());
   mobileFeature.setDeviceType(feature.getDeviceType());
   return mobileFeature;
 }