public function update($data, $where = [])
    {
        /*
         | Trigger Before Update events if
         | defined by user into model class
         |
         */
        $this->triggerEvent('beforeUpdate');

        if (!empty($where)) {
            $whereStr = $this->buildWherePlaceholderName($where);
        } else {
            list($where, $whereStr) = $this->buildWhereForUpdate();
        }

        $sql = $this->getUpdateQuery($data, strtoupper(__FUNCTION__)).$whereStr;

        try {
            $stmt = $this->resolveConnection()->prepare($sql);

            //Bind all values to query statement
            foreach ($data as $key => $val) {
                $stmt->bindValue(":$key", $val);
            }

            foreach ($where as $key => $value) {
                $stmt->bindValue(":$key", $value);
            }

            static::$queries[] = $stmt->queryString;
            $affectedRow = $stmt->execute();

            /*
             | Trigger after update events if defined
             | into model class
             |
             */
            $this->triggerEvent('afterUpdate');

            return $affectedRow;
        } catch (\PDOException  $exception) {
            throw new \Exception($exception->getMessage());
        }
    }