private static function extractDateCriteria($key, array $criteria)
    {
        $date = (!empty($criteria[$key])) ? $criteria[$key] : null;

        if (is_string($date)) {
            $date = \DateTime::createFromFormat('Y-m-d', $date);
        }

        if (false === $date) {
            throw new InvalidArgumentException(sprintf('Invalid date/time format provided "%s", expected "%s", or instance of \DateTime class.', $criteria[$key], 'Y-m-d'));
        }

        return $date;
    }