public static function get($userId, $contactId, $limit, $history = true, $key = null)
{
$query = static::baseQuery($userId, $contactId);
if (null !== $key) {
$query->andWhere([$history ? '<' : '>', 'id', $key]);
}
return new DataProvider(['query' => $query, 'pagination' => ['pageSize' => $limit]]);
}