public static function convertMongoFormatToDateTime(UTCDatetime $date)
    {
        /**
         * this $dateTime object is incorrect in case of using microseconds
         * because after conversion of \MongoDB\BSON\UTCDateTime to \DateTime
         * method $dateTime->format('U.u') returns invalid string xxxxxxxxx.zzzzzzzzz
         * part after "." contains 9 digits but it should contain up to 6 digits
         * so we have to reduce this part to 6 digits.
         *
         * @var \DateTime
         */
        $dateTime = $date->toDateTime();

        $seconds = $dateTime->format('U');
        $microseconds = substr($dateTime->format('u'), 0, 5); // we allow max 6 digits
        $fixedDateTime = DateTimeHelper::createDateTimeFromTimestampWithMilliseconds(sprintf('%s.%s', $seconds, $microseconds));

        return $fixedDateTime;
    }