@Override
 public List<Daily> getFromProxy(List<Daily> proxy) {
   Disjunction or = Restrictions.disjunction();
   for (Daily pr : proxy) {
     or.add(Restrictions.eq("id", pr.getId()));
   }
   return sessionFactory.getCurrentSession().createCriteria(Daily.class).add(or).list();
 }
  @Override
  public void removeTask(Daily task) {
    if (null != task) {
      org.hibernate.Session sess = sessionFactory.getCurrentSession();
      task = (Daily) sess.get(Daily.class, task.getId());
      List<Events> temp = task.getEventsConnectedWithTask();
      List<Calls> temp2 = task.getCallsConnectedWithTask();
      List<Contacts> temp3 = task.getContactsConnectedWithTask();

      if (temp != null && temp.size() != 0) {

        sess.enableFetchProfile("tasks-with-events");
        temp = eventsDAO.getFromProxy(temp);
        for (Events event : temp) {
          event.getConnectedTasks().remove(task);
          sess.update(event);
        }
      }

      if (temp2 != null && temp2.size() != 0) {
        sess.enableFetchProfile("tasks-with-calls");
        temp2 = callsDAO.getFromProxy(temp2);
        for (Calls call : temp2) {
          call.getTasks().remove(task);
          sess.update(call);
        }
      }

      if (temp3 != null && temp3.size() != 0) {
        sess.enableFetchProfile("tasks-with-contacts");
        temp3 = contactsDAO.getFromProxy(temp3);
        for (Contacts contact : temp3) {
          contact.getTasks().remove(task);
          sess.update(contact);
        }
      }
      sess.update(task);
      sessionFactory.getCurrentSession().delete(task);
    }
  }