public function getModelHistoryCount(string $model, $foreignKey, array $conditions = [], array $options = []): int
    {
        $conditions = Hash::merge([
            'model' => $model,
            'foreign_key' => $foreignKey
        ], $conditions);
        $options = Hash::merge([
            'includeAssociated' => false
        ], $options);

        if ($options['includeAssociated']) {
            $hashes = $this->find()
                ->select(['save_hash'])
                ->where($conditions);

            $history = $this->find()
                ->where([
                    'save_hash IN' => $hashes
                ]);
        } else {
            $history = $this->find()
                ->where($conditions);
        }

        return $history->count();
    }