/**
  *
  * @param \Accounting\Model\Account $item
  */
 public function isExisted($item)
 {
     if (!$item->getCode() || !$item->getCompanyId()) {
         return null;
     }
     $select = $this->getDbSql()->select(self::TABLE_NAME);
     $select->where(['code' => $item->getCode(), 'companyId' => $item->getCompanyId()]);
     if ($item->getId()) {
         $select->where(['id != ?' => $item->getId()]);
     }
     if ($item->getParentId()) {
         $select->where(['parentId' => $item->getParentId()]);
     } else {
         $select->where(['parentId IS NULL']);
     }
     $select->limit(1);
     $query = $this->getDbSql()->buildSqlString($select);
     $results = $this->getDbAdapter()->query($query, Adapter::QUERY_MODE_EXECUTE);
     if ($results->count()) {
         $item->exchangeArray((array) $results->current());
         return true;
     }
     return false;
 }